Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapting to gcc 15 #767

Open
jennybc opened this issue Feb 25, 2025 · 4 comments
Open

Adapting to gcc 15 #767

jennybc opened this issue Feb 25, 2025 · 4 comments
Labels
upkeep maintenance, infrastructure, and similar

Comments

@jennybc
Copy link
Member

jennybc commented Feb 25, 2025

From CRAN's gcc 15 results:

* installing *source* package ‘readxl’ ...
** this is package ‘readxl’ version ‘1.4.3’
** package ‘readxl’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C compiler: ‘gcc-15 (GCC) 15.0.1 20250223 (experimental)’
using C++ compiler: ‘g++-15 (GCC) 15.0.1 20250223 (experimental)’
make[2]: Entering directory '/data/gannet/ripley/R/packages/tests-gcc15/readxl/src'
g++-15 -std=gnu++17 -I"/data/gannet/ripley/R/gcc15/include" -DNDEBUG -Iunix -I. -I'/data/gannet/ripley/R/test-dev/cpp11/include' -I'/data/gannet/ripley/R/test-dev/progress/include' -I/usr/local/include   -fvisibility=hidden -fpic  -g -O2 -Wall -pedantic -mtune=native -Wno-ignored-attributes -Wno-parentheses -Wp,-D_FORTIFY_SOURCE=3 -fexceptions -fstack-protector-strong -fstack-clash-protection -fcf-protection   -c cpp11.cpp -o cpp11.o
g++-15 -std=gnu++17 -I"/data/gannet/ripley/R/gcc15/include" -DNDEBUG -Iunix -I. -I'/data/gannet/ripley/R/test-dev/cpp11/include' -I'/data/gannet/ripley/R/test-dev/progress/include' -I/usr/local/include   -fvisibility=hidden -fpic  -g -O2 -Wall -pedantic -mtune=native -Wno-ignored-attributes -Wno-parentheses -Wp,-D_FORTIFY_SOURCE=3 -fexceptions -fstack-protector-strong -fstack-clash-protection -fcf-protection   -c XlsWorkBook.cpp -o XlsWorkBook.o
In file included from ./libxls/xlstypes.h:44,
                 from libxls/xls.h:42,
                 from ColSpec.h:6,
                 from XlsWorkBook.h:3,
                 from XlsWorkBook.cpp:1:
/usr/local/gcc15/include/c++/15.0.1/cstdint:58:11: error: 'int_fast8_t' has not been declared in '::'
   58 |   using ::int_fast8_t;
      |           ^~~~~~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:59:11: error: 'int_fast16_t' has not been declared in '::'
   59 |   using ::int_fast16_t;
      |           ^~~~~~~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:60:11: error: 'int_fast32_t' has not been declared in '::'
   60 |   using ::int_fast32_t;
      |           ^~~~~~~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:61:11: error: 'int_fast64_t' has not been declared in '::'
   61 |   using ::int_fast64_t;
      |           ^~~~~~~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:63:11: error: 'int_least8_t' has not been declared in '::'
   63 |   using ::int_least8_t;
      |           ^~~~~~~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:64:11: error: 'int_least16_t' has not been declared in '::'
   64 |   using ::int_least16_t;
      |           ^~~~~~~~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:65:11: error: 'int_least32_t' has not been declared in '::'
   65 |   using ::int_least32_t;
      |           ^~~~~~~~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:66:11: error: 'int_least64_t' has not been declared in '::'
   66 |   using ::int_least64_t;
      |           ^~~~~~~~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:68:11: error: 'intmax_t' has not been declared in '::'
   68 |   using ::intmax_t;
      |           ^~~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:69:11: error: 'intptr_t' has not been declared in '::'
   69 |   using ::intptr_t;
      |           ^~~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:71:11: error: 'uint8_t' has not been declared in '::'
   71 |   using ::uint8_t;
      |           ^~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:72:11: error: 'uint16_t' has not been declared in '::'
   72 |   using ::uint16_t;
      |           ^~~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:73:11: error: 'uint32_t' has not been declared in '::'
   73 |   using ::uint32_t;
      |           ^~~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:74:11: error: 'uint64_t' has not been declared in '::'
   74 |   using ::uint64_t;
      |           ^~~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:76:11: error: 'uint_fast8_t' has not been declared in '::'
   76 |   using ::uint_fast8_t;
      |           ^~~~~~~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:77:11: error: 'uint_fast16_t' has not been declared in '::'
   77 |   using ::uint_fast16_t;
      |           ^~~~~~~~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:78:11: error: 'uint_fast32_t' has not been declared in '::'
   78 |   using ::uint_fast32_t;
      |           ^~~~~~~~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:79:11: error: 'uint_fast64_t' has not been declared in '::'
   79 |   using ::uint_fast64_t;
      |           ^~~~~~~~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:81:11: error: 'uint_least8_t' has not been declared in '::'
   81 |   using ::uint_least8_t;
      |           ^~~~~~~~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:82:11: error: 'uint_least16_t' has not been declared in '::'
   82 |   using ::uint_least16_t;
      |           ^~~~~~~~~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:83:11: error: 'uint_least32_t' has not been declared in '::'
   83 |   using ::uint_least32_t;
      |           ^~~~~~~~~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:84:11: error: 'uint_least64_t' has not been declared in '::'
   84 |   using ::uint_least64_t;
      |           ^~~~~~~~~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:86:11: error: 'uintmax_t' has not been declared in '::'
   86 |   using ::uintmax_t;
      |           ^~~~~~~~~
/usr/local/gcc15/include/c++/15.0.1/cstdint:87:11: error: 'uintptr_t' has not been declared in '::'
   87 |   using ::uintptr_t;
      |           ^~~~~~~~~
make[2]: *** [/data/gannet/ripley/R/gcc15/etc/Makeconf:208: XlsWorkBook.o] Error 1
make[2]: Leaving directory '/data/gannet/ripley/R/packages/tests-gcc15/readxl/src'
ERROR: compilation failed for package ‘readxl’
* removing ‘/data/gannet/ripley/R/packages/tests-strict/Libs/readxl-lib/readxl’
Command exited with non-zero status 1
Time 0:07.66, 6.83 + 0.71

I have a similar report via email from @eddelbuettel in his role as Debian maintainer.

The issue appears to be header changes, described in the Porting to GCC 15 guide:

Some C++ Standard Library headers have been changed to no longer include other headers that were being used internally by the library. As such, C++ programs that used standard library components without including the right headers will no longer compile.

In particular, the following headers are used less widely within libstdc++ and may need to be included explicitly when compiling with GCC 15:

  • <stdint.h> (for int8_t, int32_t etc.) and <cstdint> (for std::int8_t, std::int32_t etc.)
  • <ostream> (for std::endl, std::flush etc.)
@jennybc jennybc added the upkeep maintenance, infrastructure, and similar label Feb 25, 2025
@jennybc
Copy link
Member Author

jennybc commented Feb 25, 2025

This doesn't appear to be a simple lack of use of <cstdint>, because I am already including it. All the errors seem to be related to this #ifdef _GLIBCXX_USE_C99_STDINT block:

https://github.com/gcc-mirror/gcc/blob/fffe14f045df597bf5ab50730eebe0977eea7090/libstdc%2B%2B-v3/include/c_global/cstdint#L52

@jennybc jennybc mentioned this issue Feb 25, 2025
16 tasks
@jennybc
Copy link
Member Author

jennybc commented Feb 25, 2025

From the debian log:

DC-Build-Header: r-cran-readxl 1.4.3-1 / 2025-02-16 03:22:22 +0000
DC-Task: type:rebuild-binarch-only source:r-cran-readxl version:1.4.3-1 chroot:unstable esttime:81 logfile:/tmp/r-cran-readxl_1.4.3-1_unstable_gccexp.log modes:gcc-exp:binarch-only
DC-System-Info: 8 cores (Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz), 32516492 kB RAM
DC-Sbuild-call: su user42 -c 'sbuild -n --arch-any --apt-update -d unstable -v --no-run-lintian --chroot-setup-commands=/tmp/gcc-exp r-cran-readxl_1.4.3-1'
sbuild (Debian sbuild) 0.88.1~bpo12+1 (29 December 2024) on ip-10-84-234-117

+==============================================================================+
| r-cran-readxl 1.4.3-1 (amd64)                Sun, 16 Feb 2025 03:22:22 +0000 |
+==============================================================================+

Package: r-cran-readxl
Version: 1.4.3-1
Source Version: 1.4.3-1
Distribution: unstable
Machine Architecture: amd64
Host Architecture: amd64
Build Architecture: amd64
Build Type: binary

I: Unpacking /home/user42/.cache/sbuild/unstable-amd64.tar.gz to /tmp/tmp.sbuild.NMQHBUeXeo...
I: Setting up the chroot...
I: Creating chroot session...
I: Setting up log color...

(... JENNYBRYAN deleted lots of output ...)


User Environment
----------------

APT_CONFIG=/var/lib/sbuild/apt.conf
HOME=/sbuild-nonexistent
LANG=C.UTF-8
LC_ALL=C.UTF-8
LOGNAME=user42
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
SHELL=/bin/sh
USER=user42

dpkg-buildpackage
-----------------

Command: dpkg-buildpackage --sanitize-env -us -uc -b
dpkg-buildpackage: info: source package r-cran-readxl
dpkg-buildpackage: info: source version 1.4.3-1
dpkg-buildpackage: info: source distribution unstable
dpkg-buildpackage: info: source changed by Dirk Eddelbuettel <[email protected]>
 dpkg-source --before-build .
dpkg-buildpackage: info: host architecture amd64
 debian/rules clean
dh clean --buildsystem R
   dh_auto_clean -O--buildsystem=R
   dh_autoreconf_clean -O--buildsystem=R
   dh_clean -O--buildsystem=R
 debian/rules binary
dh binary --buildsystem R
   dh_update_autotools_config -O--buildsystem=R
   dh_autoreconf -O--buildsystem=R
   dh_auto_configure -O--buildsystem=R
   dh_auto_build -O--buildsystem=R
   dh_auto_test -O--buildsystem=R
   create-stamp debian/debhelper-build-stamp
   dh_testroot -O--buildsystem=R
   dh_prep -O--buildsystem=R
   dh_auto_install --destdir=debian/r-cran-readxl/ -O--buildsystem=R
I: R Package: readxl Version: 1.4.3
I: Building using R version 4.4.2-1
I: R API version: r-api-4.0
I: Using built-time from d/changelog: Fri, 07 Jul 2023 11:54:50 -0500
	mkdir -p /build/reproducible-path/r-cran-readxl-1.4.3/debian/r-cran-readxl/usr/lib/R/site-library
	R CMD INSTALL -l /build/reproducible-path/r-cran-readxl-1.4.3/debian/r-cran-readxl/usr/lib/R/site-library --clean . "--built-timestamp='Fri, 07 Jul 2023 11:54:50 -0500'"
* installing *source* package ‘readxl’ ...
** package ‘readxl’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C compiler: ‘gcc (Debian 15-20250213-1) 15.0.1 20250213 (experimental) [master r15-7502-g26baa2c09b3]’
using C++ compiler: ‘g++ (Debian 15-20250213-1) 15.0.1 20250213 (experimental) [master r15-7502-g26baa2c09b3]’
make[1]: Entering directory '/build/reproducible-path/r-cran-readxl-1.4.3/src'
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -Iunix -I. -I'/usr/lib/R/site-library/cpp11/include' -I'/usr/lib/R/site-library/progress/include'    -fvisibility=hidden -fpic  -g -O2 -ffile-prefix-map=/build/reproducible-path/r-base-4.4.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wdate-time -D_FORTIFY_SOURCE=2   -c cpp11.cpp -o cpp11.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -Iunix -I. -I'/usr/lib/R/site-library/cpp11/include' -I'/usr/lib/R/site-library/progress/include'    -fvisibility=hidden -fpic  -g -O2 -ffile-prefix-map=/build/reproducible-path/r-base-4.4.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wdate-time -D_FORTIFY_SOURCE=2   -c XlsWorkBook.cpp -o XlsWorkBook.o
In file included from ./libxls/xlstypes.h:44,
                 from libxls/xls.h:42,
                 from ColSpec.h:6,
                 from XlsWorkBook.h:3,
                 from XlsWorkBook.cpp:1:
/usr/include/c++/15/cstdint:58:11: error: ‘int_fast8_t’ has not been declared in ‘::’
   58 |   using ::int_fast8_t;
      |           ^~~~~~~~~~~
/usr/include/c++/15/cstdint:59:11: error: ‘int_fast16_t’ has not been declared in ‘::’
   59 |   using ::int_fast16_t;
      |           ^~~~~~~~~~~~
/usr/include/c++/15/cstdint:60:11: error: ‘int_fast32_t’ has not been declared in ‘::’
   60 |   using ::int_fast32_t;
      |           ^~~~~~~~~~~~
/usr/include/c++/15/cstdint:61:11: error: ‘int_fast64_t’ has not been declared in ‘::’
   61 |   using ::int_fast64_t;
      |           ^~~~~~~~~~~~
/usr/include/c++/15/cstdint:63:11: error: ‘int_least8_t’ has not been declared in ‘::’
   63 |   using ::int_least8_t;
      |           ^~~~~~~~~~~~
/usr/include/c++/15/cstdint:64:11: error: ‘int_least16_t’ has not been declared in ‘::’
   64 |   using ::int_least16_t;
      |           ^~~~~~~~~~~~~
/usr/include/c++/15/cstdint:65:11: error: ‘int_least32_t’ has not been declared in ‘::’
   65 |   using ::int_least32_t;
      |           ^~~~~~~~~~~~~
/usr/include/c++/15/cstdint:66:11: error: ‘int_least64_t’ has not been declared in ‘::’
   66 |   using ::int_least64_t;
      |           ^~~~~~~~~~~~~
/usr/include/c++/15/cstdint:68:11: error: ‘intmax_t’ has not been declared in ‘::’
   68 |   using ::intmax_t;
      |           ^~~~~~~~
/usr/include/c++/15/cstdint:69:11: error: ‘intptr_t’ has not been declared in ‘::’
   69 |   using ::intptr_t;
      |           ^~~~~~~~
/usr/include/c++/15/cstdint:71:11: error: ‘uint8_t’ has not been declared in ‘::’
   71 |   using ::uint8_t;
      |           ^~~~~~~
/usr/include/c++/15/cstdint:72:11: error: ‘uint16_t’ has not been declared in ‘::’
   72 |   using ::uint16_t;
      |           ^~~~~~~~
/usr/include/c++/15/cstdint:73:11: error: ‘uint32_t’ has not been declared in ‘::’
   73 |   using ::uint32_t;
      |           ^~~~~~~~
/usr/include/c++/15/cstdint:74:11: error: ‘uint64_t’ has not been declared in ‘::’
   74 |   using ::uint64_t;
      |           ^~~~~~~~
/usr/include/c++/15/cstdint:76:11: error: ‘uint_fast8_t’ has not been declared in ‘::’
   76 |   using ::uint_fast8_t;
      |           ^~~~~~~~~~~~
/usr/include/c++/15/cstdint:77:11: error: ‘uint_fast16_t’ has not been declared in ‘::’
   77 |   using ::uint_fast16_t;
      |           ^~~~~~~~~~~~~
/usr/include/c++/15/cstdint:78:11: error: ‘uint_fast32_t’ has not been declared in ‘::’
   78 |   using ::uint_fast32_t;
      |           ^~~~~~~~~~~~~
/usr/include/c++/15/cstdint:79:11: error: ‘uint_fast64_t’ has not been declared in ‘::’
   79 |   using ::uint_fast64_t;
      |           ^~~~~~~~~~~~~
/usr/include/c++/15/cstdint:81:11: error: ‘uint_least8_t’ has not been declared in ‘::’
   81 |   using ::uint_least8_t;
      |           ^~~~~~~~~~~~~
/usr/include/c++/15/cstdint:82:11: error: ‘uint_least16_t’ has not been declared in ‘::’
   82 |   using ::uint_least16_t;
      |           ^~~~~~~~~~~~~~
/usr/include/c++/15/cstdint:83:11: error: ‘uint_least32_t’ has not been declared in ‘::’
   83 |   using ::uint_least32_t;
      |           ^~~~~~~~~~~~~~
/usr/include/c++/15/cstdint:84:11: error: ‘uint_least64_t’ has not been declared in ‘::’
   84 |   using ::uint_least64_t;
      |           ^~~~~~~~~~~~~~
/usr/include/c++/15/cstdint:86:11: error: ‘uintmax_t’ has not been declared in ‘::’
   86 |   using ::uintmax_t;
      |           ^~~~~~~~~
/usr/include/c++/15/cstdint:87:11: error: ‘uintptr_t’ has not been declared in ‘::’
   87 |   using ::uintptr_t;
      |           ^~~~~~~~~
make[1]: *** [/usr/lib/R/etc/Makeconf:204: XlsWorkBook.o] Error 1
make[1]: Leaving directory '/build/reproducible-path/r-cran-readxl-1.4.3/src'
make[1]: Entering directory '/build/reproducible-path/r-cran-readxl-1.4.3/src'
make[1]: Leaving directory '/build/reproducible-path/r-cran-readxl-1.4.3/src'
ERROR: compilation failed for package ‘readxl’
* removing ‘/build/reproducible-path/r-cran-readxl-1.4.3/debian/r-cran-readxl/usr/lib/R/site-library/readxl’
dh_auto_install: error: R CMD INSTALL -l /build/reproducible-path/r-cran-readxl-1.4.3/debian/r-cran-readxl/usr/lib/R/site-library --clean . "--built-timestamp='Fri, 07 Jul 2023 11:54:50 -0500'" returned exit code 1
make: *** [debian/rules:7: binary] Error 25
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
--------------------------------------------------------------------------------
Build finished at 2025-02-16T03:23:33Z

Finished
--------


+------------------------------------------------------------------------------+
| Cleanup                                      Sun, 16 Feb 2025 03:23:33 +0000 |
+------------------------------------------------------------------------------+

Purging /build/reproducible-path
Not cleaning session: cloned chroot in use
E: Build failure (dpkg-buildpackage died with exit 2)

+------------------------------------------------------------------------------+
| Summary                                      Sun, 16 Feb 2025 03:23:34 +0000 |
+------------------------------------------------------------------------------+

Build Architecture: amd64
Build Type: binary
Build-Space: 4720
Build-Time: 7
Distribution: unstable
Fail-Stage: build
Host Architecture: amd64
Install-Time: 38
Job: r-cran-readxl_1.4.3-1
Machine Architecture: amd64
Package: r-cran-readxl
Package-Time: 71
Source-Version: 1.4.3-1
Space: 4720
Status: attempted
Version: 1.4.3-1
--------------------------------------------------------------------------------
Finished at 2025-02-16T03:23:33Z
Build needed 00:01:11, 4720k disk space
E: Build failure (dpkg-buildpackage died with exit 2)
DC-Status: Failed 72.519312051s

jennybc added a commit that referenced this issue Feb 25, 2025
I should not have reversed this when I applied our "usual patches" to libxls. This was a real and desirable change.

Addresses (I hope) #767

See libxls/libxls#118, libxls/libxls#127, libxls/libxls#125.
@jennybc
Copy link
Member Author

jennybc commented Feb 25, 2025

I don't have a great way to quickly prove that this is fixed, so I'll leave this open until some proof rolls in. But I am hopeful.

@eddelbuettel
Copy link

eddelbuettel commented Feb 26, 2025

If you start from a Debian-based container (such as the rocker/r-base aka r-base I stand behind) then you can get gcc-15 and friends from the 'experimental' flavour you can opt-in.

If you start from an Ubuntu-based container (such as rocker/r2u:noble that I stand behind) then you can opt-into the newer 25.04 pre-release that also has gcc-15 and friends. That is usually easy: you don't need to update the whole container, it will just pick and choose what is needed. And in a container you risk little relative to your outer system, and it is quicker than firing up a VM or alike.

I am sure there are other containers too that are suitable because people also tried to match what Brian Ripley uses on Fedora. I personally get by with the ones I look after so I am less au courant relative to the Fedora-based approaches but they also exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upkeep maintenance, infrastructure, and similar
Projects
None yet
Development

No branches or pull requests

2 participants