错误排查:ImportError: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found

错误排查:ImportError: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20’ not found (required by /usr/local/python3/lib/python3.6/site-packages/easyedge_security.cpython-36m-x86_64-linux-gnu.so)

起因:工作中,部署环境遇到以上错误,上网遍历无果(网上写的真的没啥用,找了一大推没一个能用的。。。。)

解决:

根据错误信息可知,是GLIBCXX_3.4.20缺失,通过筛选strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX发现的确如此(实验机装的是gcc3.8.5,GLIBCXX动态库只到3.4.19)

既然缺东西那就装呗~~~~

实操升级gcc库
一、下载gcc-6.1.0包及其依赖库(国内源)
wget http://mirror.hust.edu.cn/gnu/gcc/gcc-6.1.0/gcc-6.1.0.tar.gz

# 依赖库可通过查看gcc软件包中contrib/download_prerequisites获得
wget http://mirror.hust.edu.cn/gnu/mpfr/mpfr-2.4.2.tar.gz
wget http://mirror.hust.edu.cn/gnu/gmp/gmp-4.3.2.tar.gz
wget http://mirror.hust.edu.cn/gnu/mpc/mpc-1.0.1.tar.gz
二、配置环境变量,准备安装
tar zxf gcc-6.1.0.tar.gz
tar zxf gmp-4.3.2.tar.gz
mv gmp-4.3.2/ gcc-6.1.0/
cd gcc-6.1.0/
ln -sf gmp-4.3.2/ gmp
cd
tar zxf mpfr-2.4.2.tar.gz
mv mpfr-2.4.2 gcc-6.1.0
cd gcc-6.1.0/
ln -sf mpfr-2.4.2/ mpfr
cd
tar zxf mpc-1.0.1.tar.gz
mv mpc-1.0.1 gcc-6.1.0
cd gcc-6.1.0/
ln -sf mpc-1.0.1/ mpc
cd
vi /etc/profile
# 全局环境变量文末添加
	export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/gcc-6.1.0/mpc:/root/gcc-6.1.0/gmp:/root/gcc-6.1.0/mpfr

source /etc/profile
三、建立安装目录,进行安装
cd gcc-6.1.0/
mkdir build
./configure -enable-checking=release -enable-languages=c,c++ -disable-multilib
# 该步骤异常耗费时间
make && make install

此时,键入命令gcc -vg++ -v依旧还是原来的版本

# gcc版本
[root@localhost ~]# gcc -v
使用内建 specs。
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
目标:x86_64-redhat-linux
配置为:../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
线程模型:posix
gcc 版本 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)

# gcc-c++版本
[root@localhost ~]# g++ -v
使用内建 specs。
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
目标:x86_64-redhat-linux
配置为:../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
线程模型:posix
gcc 版本 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)

想要使更新的gcc库生效则需要接下来的步骤:

cp /usr/local/lib64/libstdc++.so.6.0.22 /lib64
cd /lib64
rm -rf libstdc++.so.6
ln -s libstdc++.so.6.0.22 libstdc++.so.6

此时,大功告成!!!!!!!!!!!

# 新的gcc版本
[root@localhost utils]# gcc -v
使用内建 specs。
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/6.1.0/lto-wrapper
目标:x86_64-pc-linux-gnu
配置为:./configure -enable-checking=release -enable-languages=c,c++ -disable-multilib
线程模型:posix
gcc 版本 6.1.0 (GCC)

# 新的gcc-c++版本
[root@localhost utils]# g++ -v
使用内建 specs。
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/6.1.0/lto-wrapper
目标:x86_64-pc-linux-gnu
配置为:./configure -enable-checking=release -enable-languages=c,c++ -disable-multilib
线程模型:posix
gcc 版本 6.1.0 (GCC)

感谢阅读

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
错误提示表明在安装飞浆模块后,发生了一个导入错误。具体错误是/lib64/libstdc.so.6的版本不符合要求,需要GLIBCXX_3.4.20版本,但当前系统中没有找到这个版本的。 为了解决这个问题,我们可以通过以下两个步骤来解决: 1. 首先,我们需要查看系统中GLIBCXX的版本信息。可以使用命令行输入以下命令:`strings /usr/lib64/libstdc.so.6 | grep GLIBCXX`。这个命令会列出libstdc.so.6中包含的GLIBCXX版本信息。 2. 其次,我们可以通过查看软连接来确认系统中libstdc.so.6指向的版本。使用命令行输入以下命令来查看软连接:`ls -l /usr/lib64/libstdc.so.6`。这个命令会显示libstdc.so.6的软连接信息,其中包括指向的具体版本文件。 根据以上信息,可以判断如果当前系统中没有GLIBCXX_3.4.20版本的,那么可能需要更新或者安装新的版本。你可以尝试升级libstdc++来满足飞浆模块对GLIBCXX_3.4.20版本的要求。具体的升级步骤可能因系统不同而有所差异,你可以根据自己的系统文档或者搜索引擎来查找相关的升级方法。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [libstdc++.so.6.0.25](https://download.csdn.net/download/qq_39619888/87474616)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [conda环境下“/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20‘ not found”问题解决](https://blog.csdn.net/lsb2002/article/details/131456857)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值