/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21‘ not found (required by

在某项目中遇到下面的错误,

cpp 复制代码
./model2trt_v2: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./model2trt_v2)
./model2trt_v2: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ../../../lib/linux_lib/libcuda_utils.so)
./model2trt_v2: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ../../../lib/linux_lib/libprotobuf.so.24)
./model2trt_v2: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ../../../lib/linux_lib/libprotobuf.so.24)
./model2trt_v2: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ../../../lib/linux_lib/libopencv_core.so.4.4)
./model2trt_v2: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ../../../lib/linux_lib/libopencv_core.so.4.4)
./model2trt_v2: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ../../../lib/linux_lib/libopencv_highgui.so.4.4)
./model2trt_v2: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ../../../lib/linux_lib/libopencv_imgproc.so.4.4)
./model2trt_v2: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ../../../lib/linux_lib/libopencv_imgproc.so.4.4)
./model2trt_v2: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ../../../lib/linux_lib/libopencv_imgcodecs.so.4.4)
./model2trt_v2: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ../../../lib/linux_lib/libopencv_imgcodecs.so.4.4)

然后看了下g++版本是8.5.0

出现上述错误的原因是安装了高版本的GCC之后没有更新软连接,只需要查找安装GCC时生成的最新动态库,然后添加软连接即可。

bash 复制代码
find / -name "libstdc++.so*" 

得到如下结果

bash 复制代码
/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/lib64/libstdc++.so.6
/usr/lib64/libstdc++.so.6.0.19-bak
/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
/usr/local/lib64/libstdc++.so.6.0.25
/usr/local/lib64/libstdc++.so.6
/usr/local/lib64/libstdc++.so
/usr/local/lib64/libstdc++.so.6.0.25-gdb.py
/usr/local/cuda-11.4/nsight-systems-2021.2.4/target-linux-armv8/host-linux-armv8/libstdc++.so.6
/usr/local/cuda-11.4/nsight-systems-2021.2.4/host-linux-x64/libstdc++.so.6
/usr/local/cuda-10.2/nsight-systems-2019.5.2/host-linux-x64/libstdc++.so.6
/usr/local/cuda-11.7/nsight-compute-2022.2.0/host/linux-desktop-glibc_2_11_3-x64/libstdc++.so.6
/usr/local/cuda-11.7/nsight-systems-2022.1.3/host-linux-x64/libstdc++.so.6
/opt/software/gcc/gcc-8.5.0/output/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.25
/opt/software/gcc/gcc-8.5.0/output/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6
/opt/software/gcc/gcc-8.5.0/output/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so
/opt/software/gcc/gcc-8.5.0/output/stage1-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.25
/opt/software/gcc/gcc-8.5.0/output/stage1-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6
/opt/software/gcc/gcc-8.5.0/output/stage1-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so
/opt/software/gcc/gcc-8.5.0/output/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.25
/opt/software/gcc/gcc-8.5.0/output/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6
/opt/software/gcc/gcc-8.5.0/output/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so

然后我看了下/usr/lib64/libstdc++.so.6是链接到哪里去了,

同时也可以看到在/usr/local/lib64里面有libstdc++.so.6.0.25的,所以我进行了如下操作:

bash 复制代码
cp /usr/local/lib64/libstdc++.so.6.0.25  /usr/lib64
cd /usr/lib64
ln -snf libstdc++.so.6.0.25 libstdc++.so.6

这个问题其实我之前遇到过,之前的博客笔记。

/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by_node: /lib64/libstdc++.so.6: version `glibcxx_3.4.-CSDN博客

相关推荐
雨中rain24 分钟前
Linux -- 从抢票逻辑理解线程互斥
linux·运维·c++
Bessssss44 分钟前
centos日志管理,xiao整理
linux·运维·centos
s_yellowfish44 分钟前
Linux服务器pm2 运行chatgpt-on-wechat,搭建微信群ai机器人
linux·服务器·chatgpt
豆是浪个1 小时前
Linux(Centos 7.6)yum源配置
linux·运维·centos
vvw&1 小时前
如何在 Ubuntu 22.04 上安装 Ansible 教程
linux·运维·服务器·ubuntu·开源·ansible·devops
我一定会有钱1 小时前
【linux】NFS实验
linux·服务器
Ven%1 小时前
如何在防火墙上指定ip访问服务器上任何端口呢
linux·服务器·网络·深度学习·tcp/ip
是阿建吖!1 小时前
【Linux】基础IO(磁盘文件)
linux·服务器·数据库
张暮笛1 小时前
蓝牙协议——音量控制
linux
陈君豪1 小时前
OpenCV的FAST和goodFeaturesToTrack的區別
linux