在某项目中遇到下面的错误,
./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时生成的最新动态库,然后添加软连接即可。
find / -name "libstdc++.so*"
得到如下结果
/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的,所以我进行了如下操作:
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博客