Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RHEL7 - /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found

Tags:

linux

gcc

rhel

I know this question has been asked for many times while I still get stuck with it. I have reviewed all answers previously asked like version `CXXABI_1.3.8' not found (required by ...)

How to fix: [program name] /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version CXXABI_1.3.8' not found (required by [program name])

and I've read https://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.how_to_set_paths

My system is RHEL7, I had a gcc 4.8 installed before, and I install gcc 4.9 with yum -y install devtoolset-3-gcc devtoolset-3-gcc-c++

Then gcc 4.9 is successfully installed. With gcc -v, I get

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-3/root/usr/libexec/gcc/x86_64-redhat-linux/4.9.2/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/opt/rh/devtoolset-3/root/usr --mandir=/opt/rh/devtoolset-3/root/usr/share/man --infodir=/opt/rh/devtoolset-3/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.9.2 20150212 (Red Hat 4.9.2-6) (GCC) 

Then I set my LD_LIBRARY_PATH following the others' suggestions like:

export LD_LIBRARY_PATH=/opt/rh/devtoolset-3/root/usr/lib/gcc/x86_64-redhat-linux/4.9.2:${LD_LIBRARY_PATH}

However, the error still exits and it seems my newer version gcc4.9 doesn't work. Any help would be appreciated!

like image 421
lionel Avatar asked Sep 12 '17 09:09

lionel


1 Answers

The problem is occurring because the devtoolset-x packages actually just wrap the standard system libstdc++.so so even tho' you have a new compiler, you still have the old ABI (application binary interface). So what you really need is a whole new compiler! Which will include a new library of its own.

To build the compiler you'll need to install some dependencies:

sudo yum install gmp-devel mpfr-devel libmpc-devel

You can download a newer version of GCC from one of the official mirrors, grab a version such as gcc-8.3.0.tar.gz, unpack it and in that directory

./configure --disable-multilib --enable-languages=c,c++ --prefix=$HOME/local
make -j5
make -j install

Then whenever you need a modern ABI,

export LD_LIBRARY_PATH=$HOME/local/lib64

and everything may start working. If your application spawns its own environment (such as Steam), you may want to place the libraries within a path it is searching already.

The "duplicate" answers are either wrong or outdated; this is the correct solution as of today. I know because I tried them all, and this is what actually works...

like image 50
Gaius Avatar answered Nov 02 '22 00:11

Gaius