Why is GNU libstdc++ coupled to gcc and GNU libc not?

197 Views Asked by At

The concrete reason I am asking this, is because I am trying to produce a C/C++ toolchain that can build C++17 code and produce binaries that can run on as many client systems as possible. I need at least gcc 9 for (stable) C++17 support. But that would mean the client system needs at least libstdc++.so.6.0.26 (GLIBCXX_3.4.26). It would also mean I cannot use a newer compiler without losing compatibility with several client systems, because libstdc++ is coupled to gcc.

GNU libc is not coupled to gcc. I can choose the newest compiler and still use the old glibc 2.28 to build C11 code.

1

There are 1 best solutions below

5
Employed Russian On

Why is GNU libstdc++ coupled to gcc and GNU libc not?

libstdc++ is not really coupled to GCC either -- you can use g++ to build C++ code with libc++ instead.

By default g++ uses libstdc++ because they both come from the same project, while GLIBC is a separate project.