5

I would like to use devtoolset-7 to build a C++11 application on CentOS 7. I am trying to use the <regex> library, but the version of libstdc++ included natively with CentOS 7, 4.8.4, does not support it.

I have followed the following instructions to install and enable SCL/devtoolset-7:

$ sudo yum install centos-release-scl
$ sudo yum install devtoolset-7
$ scl enable devtoolset-7 bash

At this point, if I invoke g++, it is the proper version (7.2.1), but when I build applications and run ldd on them, they are still dynamically linked to the old /lib64/libstdc++.so.6 on the system. What is the simplest way to reliably link against devtoolset-7-libstdc++-devel-7.2.1? I am using CMake 3 as the build system.

phoenix
  • 7,988
  • 6
  • 39
  • 45
  • 1
    I am using CentOS 7 and I also installed devtoolset-7 and enabled it the same way as you mentioned. I tried to compile the regex example in the regex link in your post and it works fine. I tried ldd on my executable and it references to the original libstdc++ as well. What error did you get? – Hei Dec 24 '17 at 15:24
  • @Hei compile != work fine. the original libstdc++ does not implement std::regex, it simply throws an exception or return false all the time. – Sandy Jul 08 '18 at 08:13
  • 1
    The whole point of the devtoolset version of GCC is that the binary only depends on the original system libstdc++, but that doesn't mean that `` doesn't work. If you compile with the devtoolset gcc then you get working a `` (I just tested it, and it works). The fact it's linked to the old `libstdc++.so` doesn't matter. – Jonathan Wakely Oct 02 '18 at 15:47

0 Answers0