C++ project compiled with modern compiler, but linked against outdated libstdc++

天涯浪子 提交于 2019-11-27 09:32:09

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!