One of my systems that I still use a lot runs a kind of "Frankenbuntu" 14.04 that has received lots of additional updates via PPAs and software I build and install to /opt/local (using an adapted version of the MacPorts ports system for Mac; in fact I have most of my Linux ports installed on Mac too).

The library dirs under that prefix aren't added to ldconfig so I rely on the use or rpaths and runtime setting of LD_LIBRARY_PATH.

I've been using clang 8 as my main compiler (newest version that was once provided through LLVM repos) because it's a bit faster and probably more capable than the latest GCC available from Ubuntu (9.4.0). I've built clang 12 myself (an extremely boring exercise in patience!) but just read that you really need clang 17 to get proper c++20 support. Or GCC 12.

I happen to have a port for GCC 12 too, but I've run into troubles before installing GCC (7) under /opt/local, issues that had to do with mixing libstdc++ runtimes. Those may have been due to the fact that the OS already had (or got updated to) a newer libstdc++ (the one from GCC 9.4.0), and a similar situation is not going occur again. Not until I upgrade the OS at least.

Still, I'd like to ask about some up-to-date best-practises and a succinct overview of the pitfalls (the ones less evident for someone who's been installing to and running from a parallel prefix for years). Are there any known incompatibilities between libstdc++ 9.4.0 and 12.3.0? Or the libstdc++ from 13.2.0 which is the one I have installed on my Mac?

Thanks in advance!

In reaction to the first couple of comments:

  • I'm a retro-computing "fan".

  • I know my OS is old and no longer supported. I have reasons to keep it at this version on this particular machine, and am really not looking for further suggestions that it would only take XX minutes to upgrade. I know from experience it'll take a lot more, the system is likely to be unstable until I at least downgrade to a known-compatible kernel (4.14.328 ATM) and in the meantime I won't be able to use it for anything useful. Just building GCC for my parallel prefix will take maybe 5h and will be perfectly reversible (MacPorts has a very handy de/activation feature

  • I am also aware that libstdc++ isn't forward ABI compatible but that it is at least intended to be backwards ABI compatible:

    apt contains /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++6:amd64: /usr/lib/x86_64-linux-gnu/libstdc++.so.6 apt show libstdc++6 Package: libstdc++6 State: installed Automatically installed: no Multi-Arch: same Version: 9.4.0-1ubuntu1~14.04

The libstdc++ version installed by port:libgcc13 on my Mac:

> otool -L /opt/local/lib/libgcc/libstdc++.6.dylib
        /opt/local/lib/libgcc/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.32.0)

Same SOVERSION (6), also apparent from the more tighly controlled baked-in versioning numbers of the dylib.

I interpret this as indicating that libstdc++ v13.2.0 is supposed to be a drop-in replacement for the one I currently have, just as that one was a drop-in replacement for the earlier versions that are still available for 14.04:

aptitude versions libstdc++6:amd64 Package libstdc++6:
p 4.8.2-19ubuntu1 trusty 500 p 4.8.4-2ubuntu1~14.04.4 trusty-security,trusty-updates 500 i 9.4.0-1ubuntu1~14.04 trusty 500

My question about known incompatibilities and/or issues was thus meant to be read with in the context of the intended backwards compatibility.

I have already discovered that GCC 13 no longer provides std::auto_ptr even in C++03 mode where it really ought to be present (but not if that's because of a build configuration thing).

  • That sounds like terribly much work for little gain and bad practice on top of it. You can generally do this nicely and cleanly, no problem, but you need a base system that supports containers well, and your base Ubuntu 14.04 is so incredibly dusty by now that it's really standing in your way. Ubuntu 14.04 has stopped getting updates in 2019, and will stop even getting the bare minimum of paid security updates in less than 50days. The time is ripe: update your Ubuntu, and things become easier. Anything else I'd consider a waste of your time. Mar 12 at 14:16
  • I mean, you yourself say that you're not certain whether some libraries on your system conflict, what's up with your libstdc++; this all points out that by far the easiest, and the only way that's not prone to errors, is to, once in a decade, install a new operating system. That takes 20 minutes, and you can then have any older or newer system running in environments on that. But as it stands now, your base platform is both obsolete and manually broken in ways we couldn't know, so quite honestly, I don't think it's a productive thing trying to figure out what kinds of things to bend. Mar 12 at 14:20
  • "Are there any known incompatibilities between libstdc++ 9.4.0 and 12.3.0?" Yes, they aren't compatible, which you can directly read from the fact that their major versions don't match. Mar 12 at 14:23
  • I sort of appreciate you took the time to type those 3 comments but they were not answers to my questions (the last one could have been if it wasn't mostly wrong; both GCC 9 and GCC 12 have libstdc++ v.major 6). I've edited my OQ to put a few things straight that I clearly and sadly omitted.
    – RJVB
    Mar 12 at 16:01
  • "Just building GCC for my parallel prefix will take maybe 5h and will be perfectly reversible (MacPorts has a very handy de/activation feature" you should be able to build GCC on a different machine running a more modern OS, doing the build within a Ubuntu 14.04 container. Then, you can take the resulting installation and copy it over to your retro machine. Mar 12 at 16:31

1 Answer 1


First partial answer.

After building port:libgcc13 and testing with libstdc++.so.6.0.32 in the ld.so path I can now confirm that there are indeed no obvious problems having that library loaded instead of the system's libstdc++.so.6.0.28 .

Building code against the corresponding header files makes it impossible even to link it against the system C++ runtime (undefined reference to 'std::bad_function_call::what() const') meaning it also wouldn't run against it. But that's also to be expected and no problem for me as long as I remember to use this runtime only for binaries to be installed under my parallel prefix. They would have hard dependencies on other libraries in there anyway.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .