我知道这个问题已经被问了很多次了,而我仍然被它卡住了。我已经检查了所有以前问过的答案,比如version `CXXABI_1.3.8' not found (required by ...)
我读过https://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.how_to_set_paths
我的系统是RHEL7,之前我安装了一个gcc 4.8,我在yum -y install devtoolset-3-gcc devtoolset-3-gcc-c++上安装了gcc 4.9
然后,成功安装了gcc 4.9。有了gcc -v,我得到了
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) 然后,我按照其他人的建议设置了LD_LIBRARY_PATH,如下所示:
export LD_LIBRARY_PATH=/opt/rh/devtoolset-3/root/usr/lib/gcc/x86_64-redhat-linux/4.9.2:${LD_LIBRARY_PATH}但是,这个错误仍然存在,并且我的新版本gcc4.9似乎不能工作。任何帮助都将不胜感激!
发布于 2018-05-03 04:49:12
出现这个问题是因为devtoolset-x包实际上只是包装了标准的系统libstdc++.so,所以即使你有一个新的编译器,你仍然有旧的ABI (应用程序二进制接口)。所以你真正需要的是一个全新的编译器!它将包含一个自己的新库。
要构建编译器,您需要安装一些依赖项:
sudo yum install gmp-devel mpfr-devel libmpc-devel./configure --disable-multilib --enable-languages=c,c++ --prefix=$HOME/local
make -j5
make -j install当你需要一个现代的ABI的时候,
export LD_LIBRARY_PATH=$HOME/local/lib64一切都可以开始工作了。
“重复”的答案要么是错误的,要么是过时的;这是目前正确的解决方案。我知道是因为我都试过了,这才是真正有效的方法...
https://stackoverflow.com/questions/46172600
复制相似问题