ImportError:libstdc++.so.6:version `CXXABI_1.3.8` not found

现象

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
[root@orc iocr-kit-core-release-1.5]# python3.6 server.py 
Error: Can not import avx core while this file exists: /usr/local/python3.6.9/lib/python3.6/site-packages/paddle/fluid/core_avx.so
Traceback (most recent call last):
File "server.py", line 6, in <module>
from read_ocr import read_ocr
File "/home/lp/package/iocr-kit-core-release-1.5/read_ocr.py", line 2, in <module>
from paddleocr import PaddleOCR,draw_ocr
File "/usr/local/python3.6.9/lib/python3.6/site-packages/paddleocr/__init__.py", line 16, in <module>
from .paddleocr import PaddleOCR
File "/usr/local/python3.6.9/lib/python3.6/site-packages/paddleocr/paddleocr.py", line 28, in <module>
from tools.infer import predict_system
File "/usr/local/python3.6.9/lib/python3.6/site-packages/paddleocr/tools/infer/predict_system.py", line 21, in <module>
import tools.infer.utility as utility
File "/usr/local/python3.6.9/lib/python3.6/site-packages/paddleocr/tools/infer/utility.py", line 17, in <module>
from ppocr.utils.utility import initial_logger
File "/usr/local/python3.6.9/lib/python3.6/site-packages/paddleocr/ppocr/utils/utility.py", line 19, in <module>
import paddle
File "/usr/local/python3.6.9/lib/python3.6/site-packages/paddle/__init__.py", line 25, in <module>
from .fluid import monkey_patch_variable
File "/usr/local/python3.6.9/lib/python3.6/site-packages/paddle/fluid/__init__.py", line 36, in <module>
from . import framework
File "/usr/local/python3.6.9/lib/python3.6/site-packages/paddle/fluid/framework.py", line 37, in <module>
from . import core
File "/usr/local/python3.6.9/lib/python3.6/site-packages/paddle/fluid/core.py", line 294, in <module>
raise e
File "/usr/local/python3.6.9/lib/python3.6/site-packages/paddle/fluid/core.py", line 256, in <module>
from .core_avx import *
ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/python3.6.9/lib/python3.6/site-packages/paddle/fluid/core_avx.so)

分析

解决办法大致分两类,换新链接库和升级gcc环境

换新链接库

  1. strings /usr/lib64/libstdc++.so.6|grep CXXABI:查看是否有“CXXABI_1.3.8”,没有说明需要安装

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    [root@orc]# strings /usr/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
  2. 下载一个 libstdc++.so.6 的高版本,比如 libstdc++.so.6.0.25,并放入到 /usr/lib64 目录下。

  3. 进入 /usr/lib64/ 目录下,删除或者重命名 libstdc++.so.6 ,然后执行重新构建动态库 libstdc++.so.6

    1
    2
    3
    4
    5
    6
    rm -rf libstdc++.so.6
    # 删除或重命名
    # mv libstdc++.so.6 libstdc++.so.6.bak

    # 重新创建符号连接
    ln -s libstdc++.so.6.0.25 libstdc++.so.6
  4. 最后 strings /usr/lib64/libstdc++.so.6|grep CXXABI 查看是否成功

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    [root@orc]# strings /usr/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_1.3.8
    ...

升级gcc

  • https=//blog.csdn.net/qq_39715000/article/details/120703444

ImportError:libstdc++.so.6:version `CXXABI_1.3.8` not found
https://flepeng.github.io/002-Linux-71-报错-ImportError:libstdc-so-6:version-CXXABI-1-3-8-not-found/
作者
Lepeng
发布于
2021年7月5日
许可协议