Centos 7升级gcc版本和CXXABI_1.3.8' not found错误解决
Centos 7升级gcc版本和CXXABI_1.3.8' not found错误解决
Centos 7默认gcc版本为4.8,有时需要更高版本的,这里以升级至8.3.1版本为例,分别执行下面三条命令即可,无需手动下载源码编译
1、安装centos-release-scl
sudo yum install centos-release-scl
2、安装devtoolset,注意,如果想安装7.版本的,就改成devtoolset-7-gcc,以此类推
sudo yum install devtoolset-8-gcc*
3、激活对应的devtoolset,所以你可以一次安装多个版本的devtoolset,需要的时候用下面这条命令切换到对应的版本
scl enable devtoolset-8 bash
大功告成,查看一下gcc版本
gcc -v
显示为 gcc version 8.3.1 20190311 (Red Hat 8.3.1-3) (GCC)
补充:这条激活命令只对本次会话有效,重启会话后还是会变回原来的4.8.5版本,要想随意切换可按如下操作。
首先,安装的devtoolset是在 /opt/rh 目录下的,如图
每个版本的目录下面都有个 enable 文件,如果需要启用某个版本,只需要执行
source ./enable
所以要想切换到某个版本,只需要执行
source /opt/rh/devtoolset-8/enable
可以将对应版本的切换命令写个shell文件放在配了环境变量的目录下,需要时随时切换,或者开机自启
4、直接替换旧的gcc
旧的gcc是运行的 /usr/bin/gcc,所以将该目录下的gcc/g++替换为刚安装的新版本gcc软连接,免得每次enable
mv /usr/bin/gcc /usr/bin/gcc-4.8.5
ln -s /opt/rh/devtoolset-8/root/bin/gcc /usr/bin/gcc
mv /usr/bin/g++ /usr/bin/g++-4.8.5
ln -s /opt/rh/devtoolset-8/root/bin/g++ /usr/bin/g++
gcc --version
g++ --version
二、`CXXABI_1.3.8' not found错误解决
错误内容
ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found
(required by /usr/local/python3/lib/python3.7/site-pacnsorflow/python/_pywrap_tensorflow_internal.so)
解决方案
查询自己的
strings /lib64/libstdc++.so.6 | grep CXXABI
CXXABI_1.3
CXXABI_1.3.1
CXXABI_1.3.2
CXXABI_1.3.3
CXXABI_1.3.4
CXXABI_1.3.5
CXXABI_1.3.6
CXXABI_1.3.7
CXXABI_TM_1
查询系统上的libstdc++.so
find / -name "libstdc++.so*"
/home/oracle/app/oracle/product/11.2.0/dbhome_1/lib/stubs/libstdc++.so.6
/home/oracle/app/oracle/product/11.2.0/dbhome_1/lib/stubs/libstdc++.so
find: ‘/run/user/1000/gvfs’: Permission denied
/var/lib/docker/overlay2/bbe8caaf0682e1fec1557c1f4fd8783df3101c54b7b5dedb6d6152f17f48806c/diff/usr/lib/x86_64-linux-gnu/libo.6
/var/lib/docker/overlay2/bbe8caaf0682e1fec1557c1f4fd8783df3101c54b7b5dedb6d6152f17f48806c/diff/usr/lib/x86_64-linux-gnu/libo.6.0.22
/var/lib/docker/overlay2/bbe8caaf0682e1fec1557c1f4fd8783df3101c54b7b5dedb6d6152f17f48806c/diff/usr/share/gdb/auto-load/usr/64-linux-gnu/libstdc++.so.6.0.22-gdb.py
/var/lib/docker/overlay2/b36a8373a0ba558a126b00b87518669d99eaf3baf1695a1e2e52c40088fbebfc/diff/usr/lib64/libstdc++.so.6
/var/lib/docker/overlay2/b36a8373a0ba558a126b00b87518669d99eaf3baf1695a1e2e52c40088fbebfc/diff/usr/lib64/libstdc++.so.6.0.1
/var/lib/docker/overlay2/b36a8373a0ba558a126b00b87518669d99eaf3baf1695a1e2e52c40088fbebfc/diff/usr/share/gdb/auto-load/usr/bstdc++.so.6.0.19-gdb.py
/var/lib/docker/overlay2/b36a8373a0ba558a126b00b87518669d99eaf3baf1695a1e2e52c40088fbebfc/diff/usr/share/gdb/auto-load/usr/bstdc++.so.6.0.19-gdb.pyc
/var/lib/docker/overlay2/b36a8373a0ba558a126b00b87518669d99eaf3baf1695a1e2e52c40088fbebfc/diff/usr/share/gdb/auto-load/usr/bstdc++.so.6.0.19-gdb.pyo
/var/lib/docker/overlay2/ffc8f6568e7a039213744a41f582426d9e9a73dc0b3928d244af338fcd1e72ca/diff/usr/share/elasticsearch/moduck-ml/platform/linux-x86_64/lib/libstdc++.so.6
/var/lib/docker/overlay2/065e3e36db4f3fe3ed42e4bf576dd78eefdfacfeb5da46345652276e5684e157/diff/usr/lib/libstdc++.so.6
/var/lib/docker/overlay2/065e3e36db4f3fe3ed42e4bf576dd78eefdfacfeb5da46345652276e5684e157/diff/usr/lib/libstdc++.so.6.0.28
/var/lib/docker/overlay2/83ab3664426d4266880c6cf241eca1dd14364fd91892f11a4ca58c31c46c4050/diff/usr/lib/x86_64-linux-gnu/libo.6
/var/lib/docker/overlay2/83ab3664426d4266880c6cf241eca1dd14364fd91892f11a4ca58c31c46c4050/diff/usr/lib/x86_64-linux-gnu/libo.6.0.25
/var/lib/docker/overlay2/83ab3664426d4266880c6cf241eca1dd14364fd91892f11a4ca58c31c46c4050/diff/usr/share/gdb/auto-load/usr/64-linux-gnu/libstdc++.so.6.0.25-gdb.py
/var/lib/docker/overlay2/60740f520c63b920757df182ffe36db71573b2f5753ddbc972a7845fc5b2cb3c/diff/usr/lib/x86_64-linux-gnu/libo.6
/var/lib/docker/overlay2/60740f520c63b920757df182ffe36db71573b2f5753ddbc972a7845fc5b2cb3c/diff/usr/lib/x86_64-linux-gnu/libo.6.0.25
/var/lib/docker/overlay2/60740f520c63b920757df182ffe36db71573b2f5753ddbc972a7845fc5b2cb3c/diff/usr/share/gdb/auto-load/usr/64-linux-gnu/libstdc++.so.6.0.25-gdb.py
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/32/libstdc++.so
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/libstdc++.so
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/32/libstdc++.so
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/libstdc++.so
/usr/lib64/libstdc++.so.6
/usr/lib64/libstdc++.so.6.0.19
/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.py
/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.pyc
/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.pyo
查看其中一个
strings /var/lib/docker/overlay2/83ab3664426d4266880c6cf241eca1dd14364fd91892f11a4ca58c31c46c4050/diff/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25 | grep CXXABI
CXXABI_1.3
CXXABI_1.3.1
CXXABI_1.3.2
CXXABI_1.3.3
CXXABI_1.3.4
CXXABI_1.3.5
CXXABI_1.3.6
CXXABI_1.3.7
CXXABI_1.3.8
CXXABI_1.3.9
CXXABI_1.3.10
CXXABI_1.3.11
CXXABI_TM_1
CXXABI_FLOAT128
复制动态库:
sudo cp /var/lib/docker/overlay2/83ab3664426d4266880c6cf241eca1dd14364fd91892f11a4ca58c31c46c4050/diff/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25 /usr/lib64/
改变软连接的指向
sudo rm libstdc++.so.6
sudo ln -s libstdc++.so.6.0.25 libstdc++.so.6
在当下的阶段,必将由程序员来主导,甚至比以往更甚。