1

If I download and try to build GCC 8.x on a newer machine, e.g. Devuan Excalibur GNU/Linux (i.e. Debian Trixie without systemd) - this fails, with the error going something like this:

libstdc++.so.6: version `GLIBCXX_3.4.30' not found

If I manually copy my system's libstdc++6.so over the file missing the relevant [?] - and repeat the process a few times - I get to a different error:

make[7]: Entering directory '/usr/local/src/gcc-8.5.0/x86_64-pc-linux-gnu/32/libitm'
In file included from /usr/include/linux/fs.h:19,
                 from ../../.././libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:68:
/usr/include/linux/mount.h:96:6: error: multiple definition of ‘enum fsconfig_command’
 enum fsconfig_command {
      ^~~~~~~~~~~~~~~~
In file included from ../../.././libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:55:
/usr/local/src/gcc-8.5.0/host-x86_64-pc-linux-gnu/gcc/include-fixed/sys/mount.h:249:6: note: previous definition here
 enum fsconfig_command
      ^~~~~~~~~~~~~~~~
In file included from /usr/include/linux/fs.h:19,
                 from ../../.././libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:68:
/usr/include/linux/mount.h:130:8: error: redefinition of ‘struct mount_attr’
 struct mount_attr {
        ^~~~~~~~~~
In file included from ../../.././libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:55:
/usr/local/src/gcc-8.5.0/host-x86_64-pc-linux-gnu/gcc/include-fixed/sys/mount.h:219:8: note: previous definition of ‘struct mount_attr’
 struct mount_attr
        ^~~~~~~~~~

which is weird, but perhaps my fault for trying to force the library version. Anyway - how can I GCC 8.5.0 to actually build on my machine?

Note:

  • The configuration is: ./configure --disable-bootstrap --enable-languages=c,c++.
  • Any additional information will be provided per request.
einpoklum
  • 9,515
  • 1
    There might be a difference between Devuan and Debian here — the build works fine for me on Debian 13. – Stephen Kitt Dec 24 '23 at 14:12
  • @StephenKitt : Fair comment, but it might also be something on my specific system (e.g. since I dist-upgraded from chimaera to daedalus to excalibur or for another reason) rather than a Debian-vs-Devuan difference. – einpoklum Dec 24 '23 at 15:03
  • Yes, it could be (I can’t think of a difference between Devuan and Debian which would produce this result). The same procedure works fine for me on Debian 11 and 12 too. You could try building without libstdc++ (--disable-libstdcxx). – Stephen Kitt Dec 24 '23 at 15:17
  • @StephenKitt: I'll try it, just to see what kind of errors I'm getting; but I do want libstdcxx . – einpoklum Dec 24 '23 at 19:42
  • Right, but do you need the GCC 8 version, or is the current version in your distro OK? – Stephen Kitt Dec 24 '23 at 20:56
  • @StephenKitt: I need GCC 8.x to use with CUDA 10.x, which doesn't support newer GCC versions; and I need to use CUDA 10.x since I'm the author of a library which involves CUDA, and I want it to support CUDA 10.x. Also - the trial worked: The build completed successfully when I didn't build libstdcxx. – einpoklum Dec 24 '23 at 21:10
  • Yes, it was clear you needed GCC 8, I was just wondering about libstdc++. – Stephen Kitt Dec 24 '23 at 21:24
  • @StephenKitt: My test programs use libstdc++ ; my library itself doesn't require it for linking. – einpoklum Dec 24 '23 at 23:07
  • See this question and answer for an sane approach to solving your issue. – eyoung100 Jan 26 '24 at 17:21
  • @eyoung100: It doesn't resolve my issue, I don't want a containerized or virtualized environment, I want the one I have now. Will post an answer soon. – einpoklum Jan 26 '24 at 18:52
  • 1
    Then consider at least using the tools from build-essential in your repo and the package manager agnostic documentation in a changeroot, so you minimize risk to your system. – eyoung100 Jan 26 '24 at 18:57
  • @eyoung100: I could, but if you'll look at my answer, you'll see it's much simpler than that, with no risk of danger to the system. – einpoklum Jan 26 '24 at 19:01

1 Answers1

0

The solution involves several steps:

  • Install apt packages for the static 64-bit and 32-bit version of the GCC standard C++ library: libstdc++-dev and lib32stdc++-dev
  • Configure the GCC repository so as not to build the sanitizer library: Add --disable-libsanitizer argument for the configure command.

That should do the trick. Note that, over time and with newer versions of Debian, more things might break than you can hope to fix or get around.

Relevant GCC "bug" pages:

einpoklum
  • 9,515