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.

Answer from Jonathan Wakely on Stack Overflow
🌐
Stack Overflow
stackoverflow.com › questions › 50712896 › devtoolset-6-is-using-system-libstdc-and-cant-link
g++ - devtoolset-6 is using system libstdc++ and can't link - Stack Overflow
@KnudLarsen that's inaccurate. devtoolset-6-gcc-c++ will install devtoolset-6-libstdc++-devel which is the corresponding libstdc++ for GCC 6.3.1, but it only provides a static library that contains symbols not found in the older system libstdc++. ...
🌐
Red Hat
bugzilla.redhat.com › show_bug.cgi
1167957 – devtoolset-3-libstdc++-devel requires on /usr/lib64/libstdc++.so.6 triggers filelist download
Login · Log in using an account from: · Fedora Account System · Red Hat Associate · Red Hat Customer · Or login using a Red Hat Bugzilla account · Forgot Password · Red Hat Bugzilla – Bug 1167957 · Simple Search · Advanced Search
Discussions

c++ - Pointing to libstdc++ from devtoolset - software collection - Stack Overflow
I have an application program "Cprog" that requires GCC 4.9 and C++11's libstdc++.so. To fulfill this requirement on CentOS 6, I am using Red Hat's devtoolset-6. This lib is located at: $ scl ... More on stackoverflow.com
🌐 stackoverflow.com
April 23, 2019
Possibly wrong link order / devtoolset-8 libstdc++ unknown symbols
*/ OUTPUT_FORMAT(elf64-x86-64) ...libstdc++.so.6 -lstdc++_nonshared ) Which is trickery to, as mentioned above, use ABI hacks, this confuses ld and I think removes the special handling for libstdc++ ... -o bazel-out/host/bin/external/com_google_protobuf/protoc -Wl,-S -fuse-ld=gold -Wl,-no-as-needed -Wl,-z,relro,-z,now -B/opt/rh/devtoolset-8/root/usr/bin ... More on github.com
🌐 github.com
9
November 28, 2019
gcc - C++ project compiled with modern compiler, but linked against outdated libstdc++ - Stack Overflow
Copy[builder@f7279ae9f33f build ... /lib64/libstdc++.so.6 ... @FireLancer I don't include libstdc++ headers, I thought that compiler should do it implicitly (updated the question). ... Save this answer. ... Show activity on this post. Anyway, the resulting artifacts appear to be linked with system default version of libstdc++: Yes. The devtoolset-6-gcc-c++ ... More on stackoverflow.com
🌐 stackoverflow.com
October 2, 2018
CentOS: Using GCC 4.7 from devtoolset results in linking libstdc++ incorrectly (undefined symbols) - Stack Overflow
I am using the devtoolset-1.0 for CentOS 6.3 in order to upgrade temporarily the GCC version. Although I am now able to compile my C++ application, the final binary is missing some symbols: $ ldd -d -r myapp $ [..] $ libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000003216e00000) $ [..] $ ... More on stackoverflow.com
🌐 stackoverflow.com
October 2, 2018
🌐
Red Hat
listman.redhat.com › archives › sclorg › 2017-February › msg00001.html
[scl.org] devtoolset toolchain shared libs (libstdc++,libgcc,etc)
February 9, 2017 - [build at cls-scelbuild-72 tmp]$ scl enable devtoolset-6 'ldd /opt/rh/devtoolset-6/root/usr/lib64/libboost_filesystem.so.1.53.0' linux-vdso.so.1 => (0x00007ffecfbbe000) libboost_system.so.1.53.0 => /opt/rh/devtoolset-6/root/usr/lib64/libboost_system.so.1.53.0 (0x00007f52ac67d000) libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f52ac365000) libm.so.6 => /lib64/libm.so.6 (0x00007f52ac063000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f52abe4d000) libc.so.6 => /lib64/libc.so.6 (0x00007f52aba8a000) /lib64/ld-linux-x86-64.so.2 (0x00007f52acab6000) [build at cls-scelbuild-72 tmp]$ find /opt/rh/de
🌐
Stack Overflow
stackoverflow.com › questions › 55811772 › pointing-to-libstdc-from-devtoolset-software-collection
c++ - Pointing to libstdc++ from devtoolset - software collection - Stack Overflow
April 23, 2019 - I found the libstdc++.so in devtoolset is just a 'link', try to cat that file then can find that: Copy[root@localhost 10]# cat libstdc++.so /* GNU ld script Use the shared library, but some functions are only in the static library, so try that secondarily. */ OUTPUT_FORMAT(elf64-x86-64) INPUT ( /usr/lib64/libstdc++.so.6 -lstdc++_nonshared )
🌐
GitHub
github.com › bazelbuild › bazel › issues › 10327
Possibly wrong link order / devtoolset-8 libstdc++ unknown symbols · Issue #10327 · bazelbuild/bazel
November 28, 2019 - */ OUTPUT_FORMAT(elf64-x86-64) INPUT ( /usr/lib64/libstdc++.so.6 -lstdc++_nonshared ) Which is trickery to, as mentioned above, use ABI hacks, this confuses ld and I think removes the special handling for libstdc++ ... -o bazel-out/host/bin/external/com_google_protobuf/protoc -Wl,-S -fuse-ld=gold -Wl,-no-as-needed -Wl,-z,relro,-z,now -B/opt/rh/devtoolset-8/root/usr/bin -pass-exit-codes -Wl,--gc-sections bazel-out/host/bin/external/com_google_protobuf/_objs/protoc/main.o -Wl,--start-lib bazel-out/host/bin/external/com_google_protobuf/_objs/protoc_lib/code_generator.o SNIP SNIP %< ...
Author   bazelbuild
🌐
LWN.net
lwn.net › Articles › 862013
So what's the point here? [LWN.net]
July 7, 2021 - The magic is that devtoolset (gcc-toolset in RHEL 8) installs a linker script as its "libstdc++.so" that pulls in both the libstdc++.so.6 provided by the base system and a separate libstdc++_nonshared.a that contains those symbols not provided by the base system's libstdc++.so.6.
Find elsewhere
🌐
Red Hat
bugzilla.redhat.com › show_bug.cgi
1589111 – devtools-6 and devtoolset-7 with libstdc++-4.8 operates incorrectly with std::error_condition
June 8, 2018 - Login · Log in using an account from: · Fedora Account System · Red Hat Associate · Red Hat Customer · Or login using a Red Hat Bugzilla account · Forgot Password · Create an Account · Red Hat Bugzilla – Bug 1589111 · Simple Search
🌐
Google Groups
groups.google.com › a › tensorflow.org › g › build › c › Xo190xAPyW8
The linking of libstdc++ (again, sorry)
Hm, my wheel built off of a centos6/devtoolset-7 seems to include symbols outside the manylinux10 spec. glibc looks fine, but libstdc++ is not. ... $ auditwheel show tensorflow-1.13.1-cp36-cp36m-linux_x86_64.whl tensorflow-1.13.1-cp36-cp36m-linux_x86_64.whl is consistent with the following platform tag: "linux_x86_64". The wheel references external versioned symbols in these system- provided shared libraries: libc.so.6 with versions {'GLIBC_2.7', 'GLIBC_2.17', 'GLIBC_2.3.3', 'GLIBC_2.2.5', 'GLIBC_2.3.4', 'GLIBC_2.3', 'GLIBC_2.3.2', 'GLIBC_2.4', 'GLIBC_2.16', 'GLIBC_2.14', 'GLIBC_2.11', 'GLIBC_2.9', 'GLIBC_2.15', 'GLIBC_2.6', 'GLIBC_2.10'}, librt.so.1 with versions {'GLIBC_2.2.5'}, libgcc_s.so.1 with versions
🌐
GitHub
github.com › sysrepo › sysrepo › issues › 1328
Want to confirm whether it's OK to ignore the "libstdc++.so.6(GLIBCXX_3.4.21)(64bit) is needed" dependency when installing the sysrepo · Issue #1328 · sysrepo/sysrepo
October 18, 2018 - #rpm -ivh sysrepo-0.1.0-18.11.x86_64.rpm error: Failed dependencies: libstdc++.so.6(GLIBCXX_3.4.21)(64bit) is needed by cnet-c-sysrepo-0.1.0-18.11.x86_64 # rpm -ivh sysrepo-0.1.0-18.11.x86_64.rpm --nodeps Preparing... ################################# [100%] Updating / installing...
Author   sysrepo
🌐
Reddit
reddit.com › r/cpp › devtoolset is a game changer for c++ development on linux
r/cpp on Reddit: Devtoolset is a game changer for C++ development on Linux
March 23, 2018 -

On Linux the dependency on system compilers have always been frustrating since it means your stuck with ancient GCC versions. But I must say I'm very impressed with devtoolset for RHEL/CentOS, it means you can use gcc-7 on old crappy RHEL6 that so many large companies insist on using. And you can ship the resulting binaries and it will run on plain vanilla RHEL installations!

Top answer
1 of 5
12

what is devtoolset ?

2 of 5
6

devtoolset-7 also provides newer versions of lots of supporting debug and performance tools like gdb.

They (RH or Centos) also provide containerised versions of the build tools and the performance tools.

There is also a tech preview of the llvm-toolset, admittedly at clang v4 but still able to build those compatible binaries.

Note that you want to build using a host that is lower or same version as your minimum target version.

e.g. toolset-7 on host centos v6.7 will create bins compatible with 6.7, 6.9 and 7.x If your host is say centos 7.2 toolset-7 builds are only guaranteed to be compatible with v7.2+ targets.

Redhat's documentation is really good (and you can even get a free developer login to access more resources).

Also note that Centos provides similar options to RHEL.

The only downside is I don't think you can use the new ABI variant of CXX LIB as the ABI isn't compatible with older compilers like the default Centos gcc 4

Not really a problem as you can still use the C++11/14/17 features, just a few items are incompatible (such as list::size() still being O(n) and not const time, or strings still being COW)

https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/ (Lots of other tools/langs etc there too like Go,Rust,Python3 and lots of database updated versions etc.)

Not sure if you need to have a developer account, but an example of the documentation: https://access.redhat.com/documentation/en-us/red_hat_developer_toolset/7/html/7.0_release_notes/dts7.0_release

🌐
GitHub
github.com › AppImage › AppImageKit › issues › 1063
Investigate special linker script instead of a dynamic library for libstdc++.so · Issue #1063 · AppImage/AppImageKit
July 23, 2020 - We should understand how this magic ... · 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....
Author   AppImage
🌐
Stack Overflow
stackoverflow.com › tags › devtoolset › hot
Hottest 'devtoolset' Answers - Stack Overflow
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 ...
🌐
Rocky Linux Forum
forums.rockylinux.org › rocky linux help & support
Install devtoolset-7 on Rocky - Rocky Linux Help & Support - Rocky Linux Forum
January 13, 2022 - I recently changed from CentOS 7 (GCC version 7.3.1.) to Rocky 8.5 (GCC version 8.5.0). When I compile C++ code with GCC on Rocky and want to execute it on another system with CentOS 7 I get the following errors: ./program: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required ...
🌐
Cloudlinux
repo.cloudlinux.com › other › sclo › 6 › devtoolset-6 › i686
Index of /other/sclo/6/devtoolset-6/i686/
../ repodata/ 26-Sep-2017 11:37 ... 26-Sep-2017 11:36 17056 devtoolset-6-libquadmath-devel-6.3.1-3.1.el6.i6..> 26-Sep-2017 11:36 217068 devtoolset-6-libstdc++-devel-6.3.1-3.1.el6.i686..> 26-Sep-2017 11:36 2861468 devtoolset-6-libstdc++-docs-6.3.1-3.1.el6.i686.rpm 26-Sep-2017 ...
🌐
Stack Exchange
unix.stackexchange.com › questions › 787053 › how-to-run-node-v20-x-on-centos-7-9
gcc - How to run node v20.x on CentOs 7.9? - Unix & Linux Stack Exchange
# https://gist.github.com/moha... enable devtoolset-8 cd gcc-6.5.0 ./contrib/download_prerequisites mkdir build cd build ../configure --prefix=/opt/gcc-6.5.0 --disable-multilib # depend on the performance of your hardware, this may take hours and many GiBs of disk space time make -j"$(nproc)" make install exit ln -s /opt/gcc-6.5.0/lib64/libstdc++.so.6.0.22 ...