C++ project compiled with modern compiler, but linked against outdated libstdc++
Solution 1:
Anyway, the resulting artifacts appear to be linked with system default version of libstdc++:
Yes. The devtoolset-6-gcc-c++
package provides a custom version of GCC that uses a special linker script instead of a dynamic library for libstdc++.so
. That means the binaries it produces do not depend on the newer libstdc++.so.6
and can be run on other CentOS machines that don't have devtoolset installed (i.e. they only have the older libstdc++ library from GCC 4.8).
Is this build environment configuration valid?
Yes. What you're seeing is completely normal, and how it's supposed to work.
The pieces of the newer C++ runtime from GCC 6.4.0 get statically linked into your binary, and at runtime it only depends on the old libstdc++.so
which every CentOS system has installed.
That's the whole point of the devtoolset version of GCC.