centos7环境升级默认的gcc-4.8.5到gcc-8.2并且升级glibc到glibc-2.28

centos7环境升级默认的gcc-4.8.5到gcc-8.2并且升级glibc到glibc-2.28


公司新做了一个图片识别的底层sdk,这个SDK是依赖centos8的glibcxx3.4.25编译处理的,我们的系统是centos7短时间内升级centos7代价太大,需要将centos的glibcxx升级到3.4.25来适配这个sdk的接口
glibcxx3.4.25所依托的glibc是glibc-2.28,这个可以通过启动docker模拟的centos8系统来查看

centos7默认的 gcc 版本为 4.8.5,这个版本的gcc 无法编译高版本的glibc 2.28

需要升级gcc到8.2版本

注意:gcc升级到9.2版本是不行的编译的时候报错和glibc2.28不兼容


# centos7自带默认的glibc

复制代码
# strings /lib64/libc.so.6 | grep GLIBC
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_2.15
GLIBC_2.16
GLIBC_2.17
复制代码

# 查看glibc 软件版本号

# rpm -qa | grep glibc 
glibc-2.17-307.el7.1.x86_64
glibc-devel-2.17-307.el7.1.x86_64
glibc-2.17-307.el7.1.i686
glibc-common-2.17-307.el7.1.x86_64
glibc-headers-2.17-307.el7.1.x86_64

# 通过 docker 启动 centos8 系统来查看glibc版本

# docker run -it --name=mycentos centos
# centos 8默认的glibc为2.28

复制代码
[root@9b943b198905 /]# ls -l /usr/lib64/libstdc++.so.6
lrwxrwxrwx 1 root root 19 Jun 15  2020 /usr/lib64/libstdc++.so.6 -> libstdc++.so.6.0.25

[root@9b943b198905 /]# strings /usr/lib64/libstdc++.so.6 | grep GLIBC
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBCXX_3.4.23
GLIBCXX_3.4.24
GLIBCXX_3.4.25
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.14
GLIBC_2.4
GLIBC_2.18
GLIBC_2.16
GLIBC_2.17
GLIBC_2.3.2
GLIBCXX_DEBUG_MESSAGE_LENGTH
GA+GLIBCXX_ASSERTIONS

[root@9b943b198905 /]# rpm -qa | grep glibc 
glibc-minimal-langpack-2.28-127.el8.x86_64
glibc-2.28-127.el8.x86_64
glibc-common-2.28-127.el8.x86_64
复制代码

1.安装gcc-8.2.0所依赖的环境

a.yum install bison -y
yum -y install wget bzip2 gcc gcc-c++ glibc-headers

b.升级GNU Make 3.82到4.2.1

复制代码
wget http://ftp.gnu.org/gnu/make/make-4.2.1.tar.gz
tar -zxvf make-4.2.1.tar.gz
cd make-4.2.1
mkdir build
cd build
../configure --prefix=/usr/local/make && make && make install
export PATH=/usr/local/make/bin:$PATH
ln -s /usr/local/make/bin/make /usr/local/make/bin/gmake
make -v
复制代码

c.安装python3.8版本

wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz
xz -d Python-3.8.0.tar.xz
tar xf Python-3.8.0.tar
cd Python-3.8.0
./configure --prefix=/usr/local/python3
make -j 4 && make install
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

4.安装gcc8.2.0

# centos7.8编译安装gcc9.2

复制代码
# wget https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.gz
# tar xf gcc-9.2.0.tar.gz
# cd gcc-9.2.0
# ./contrib/download_prerequisites    #下载gmp mpfr mpc等供编译需求的依赖项
2019-09-17 01:43:33 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2 [2383840] -> "./gmp-6.1.0.tar.bz2" [1]
2019-09-17 01:43:39 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2 [1279284] -> "./mpfr-3.1.4.tar.bz2" [1]
2019-09-17 01:43:43 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz [669925] -> "./mpc-1.0.3.tar.gz" [1]
2019-09-17 01:43:50 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2 [1658291] -> "./isl-0.18.tar.bz2" [1]
gmp-6.1.0.tar.bz2: 确定
mpfr-3.1.4.tar.bz2: 确定
mpc-1.0.3.tar.gz: 确定
isl-0.18.tar.bz2: 确定
All prerequisites downloaded successfully.

# mkdir build    #不能在source目录下configure必须在上一层的目录下
# cd build
[root@sz_jszx_cloud_dev01_17_58 build]# ../configure --prefix=/usr/local/gcc-9.2.0 --enable-bootstrap --enable-checking=release --enable-languages=c,c++ --disable-multilib
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for gawk... gawk
checking for libatomic support... yes
checking for libitm support... yes
checking for libsanitizer support... yes
checking for libvtv support... yes
checking for libhsail-rt support... yes
checking for libphobos support... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ accepts -static-libstdc++ -static-libgcc... no
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for objdir... .libs
configure: WARNING: using in-tree isl, disabling version check
*** This configuration is not supported in the following subdirectories:
     gnattools gotools target-libada target-libhsail-rt target-libphobos target-zlib target-libbacktrace target-libgfortran target-libgo target-libffi target-libobjc target-liboffloadmic
    (Any other directories should still work fine.)
checking for default BUILD_CONFIG... bootstrap-debug
checking for --enable-vtable-verify... no
checking for bison... bison -y
checking for bison... bison
checking for gm4... no
checking for gnum4... no
checking for m4... m4
checking for flex... no
checking for lex... no
checking for flex... no
checking for makeinfo... no
/usr/local/gcc-9.2.0/missing: line 81: makeinfo: command not found
checking for expect... no
checking for runtest... no
checking for ar... ar
checking for as... as
checking for dlltool... no
checking for ld... ld
checking for lipo... no
checking for nm... nm
checking for ranlib... ranlib
checking for strip... strip
checking for windres... no
checking for windmc... no
checking for objcopy... objcopy
checking for objdump... objdump
checking for otool... no
checking for readelf... readelf
checking for cc... cc
checking for c++... c++
checking for gcc... gcc
checking for gfortran... no
checking for gccgo... no
checking for gdc... no
checking for ar... no
checking for ar... ar
checking for as... no
checking for as... as
checking for dlltool... no
checking for dlltool... no
checking for ld... no
checking for ld... ld
checking for lipo... no
checking for lipo... no
checking for nm... no
checking for nm... nm
checking for objcopy... no
checking for objcopy... objcopy
checking for objdump... no
checking for objdump... objdump
checking for otool... no
checking for otool... no
checking for ranlib... no
checking for ranlib... ranlib
checking for readelf... no
checking for readelf... readelf
checking for strip... no
checking for strip... strip
checking for windres... no
checking for windres... no
checking for windmc... no
checking for windmc... no
checking where to find the target ar... host tool
checking where to find the target as... host tool
checking where to find the target cc... just compiled
checking where to find the target c++... just compiled
checking where to find the target c++ for libstdc++... just compiled
checking where to find the target dlltool... host tool
checking where to find the target gcc... just compiled
checking where to find the target gfortran... host tool
checking where to find the target gccgo... host tool
checking where to find the target gdc... host tool
checking where to find the target ld... host tool
checking where to find the target lipo... host tool
checking where to find the target nm... host tool
checking where to find the target objcopy... host tool
checking where to find the target objdump... host tool
checking where to find the target otool... host tool
checking where to find the target ranlib... host tool
checking where to find the target readelf... host tool
checking where to find the target strip... host tool
checking where to find the target windres... host tool
checking where to find the target windmc... host tool
checking whether to enable maintainer-specific portions of Makefiles... no
configure: creating ./config.status
config.status: creating Makefile
复制代码

# 多核cpu编译,否则时间可能超过3个小时

# make -j 4 && make install

# 加入环境变量

# echo -e '\nexport PATH=/usr/local/gcc-9.2.0/bin:$PATH\n' >> /etc/profile.d/gcc.sh && source /etc/profile.d/gcc.sh

# 查看gcc版本

[root@sz_jszx_cloud_dev01_17_58 build]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc-9.2.0/libexec/gcc/x86_64-pc-linux-gnu/9.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/usr/local/gcc-9.2.0 --enable-bootstrap --enable-checking=release --enable-languages=c,c++ --disable-multilib
Thread model: posix
gcc version 9.2.0 (GCC)

# 导出头文件

# ln -sv /usr/local/gcc-9.2.0/include/ /usr/include/gcc

# 配置生效

复制代码
[root@sz_jszx_cloud_dev01_17_58 build]# ldconfig -v
ldconfig: Can't stat /libx32: No such file or directory
ldconfig: Path `/usr/lib' given more than once
ldconfig: Path `/usr/lib64' given more than once
ldconfig: Can't stat /usr/libx32: No such file or directory
/usr/lib64//bind9-export:
        libisccfg-export.so.160 -> libisccfg-export.so.160.2.1
        libisc-export.so.169 -> libisc-export.so.169.0.3
        libirs-export.so.160 -> libirs-export.so.160.0.5
        libdns-export.so.1102 -> libdns-export.so.1102.1.2
/usr/lib64/mysql:
        libmysqlclient.so.21 -> libmysqlclient.so.21.1.22
        libmysqlclient.so.18 -> libmysqlclient_r.so.18.1.0
/lib:
/lib64:
        liblzf.so.1 -> liblzf.so.1.0.0
        libicuuc.so.65 -> libicuuc.so.65.1
        libicutu.so.65 -> libicutu.so.65.1
        libicutest.so.65 -> libicutest.so.65.1
        libicuio.so.65 -> libicuio.so.65.1
        libicui18n.so.65 -> libicui18n.so.65.1
        libicudata.so.65 -> libicudata.so.65.1
        libkadm5srv_mit.so.11 -> libkadm5srv_mit.so.11.0
复制代码

# 导出验证

root@xxx-xxxx /opt/tmp/gcc-9.2.0/build # ldconfig -p |grep gcc    
    libgcc_s.so.1 (libc6,x86-64) => /lib64/libgcc_s.so.1

# ldconfig -p |grep gcc 
        libgcc_s.so.1 (libc6,x86-64) => /lib64/libgcc_s.so.1

5.gcc9.2版本太新和glibc-2.28不兼容,更换为 gcc-8.2.0,编译过程和gcc9.2一样
获取 gcc-8.2.0版本源码
wget http://ftp.gnu.org/gnu/gcc/gcc-8.2.0/gcc-8.2.0.tar.gz

tar xf gcc-8.2.0.tar.gz
cd gcc-8.2.0/

复制代码
[root@sz_jszx_cloud_dev01_17_58 gcc-8.2.0]# ./contrib/download_prerequisites
2021-02-26 17:01:45 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2 [2383840] -> "./gmp-6.1.0.tar.bz2" [1]
2021-02-26 17:03:08 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2 [1279284] -> "./mpfr-3.1.4.tar.bz2" [1]
2021-02-26 17:04:00 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz [669925] -> "./mpc-1.0.3.tar.gz" [1]
2021-02-26 17:06:35 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2 [1658291] -> "./isl-0.18.tar.bz2" [1]
gmp-6.1.0.tar.bz2: OK
mpfr-3.1.4.tar.bz2: OK
mpc-1.0.3.tar.gz: OK
isl-0.18.tar.bz2: OK
All prerequisites downloaded successfully.
# mkdir build
# cd build
复制代码

# 预编译

# ../configure --prefix=/usr/local/gcc-8.2.0 --enable-bootstrap --enable-checking=release --enable-languages=c,c++ --disable-multilib

# 开启多线程编辑加快速度

make -j 4 && make install

修改环境变量,使得gcc-8.2.0为默认的gcc
# vim /etc/profile

export PATH=/usr/local/gcc-8.2.0/bin${PATH:+:${PATH}}
export MANPATH=/usr/local/gcc-8.2.0/share/man:${MANPATH}
export INFOPATH=/usr/local/gcc-8.2.0/share/info${INFOPATH:+:${INFOPATH}}
export LD_LIBRARY_PATH=/usr/local/gcc-8.2.0/libexec/gcc/x86_64-pc-linux-gnu/7.2.0:/usr/local/gcc-8.2.0/lib64:/usr/local/gcc-8.2.0/lib/gcc/x86_64-pc-linux-gnu/8.2.0/plugin${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

使其生效:

复制代码
. /etc/profile

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc-8.2.0/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/usr/local/gcc-8.2.0 --enable-bootstrap --enable-checking=release --enable-languages=c,c++ --disable-multilib
Thread model: posix
gcc version 8.2.0 (GCC)
复制代码

#导出头文件

复制代码
# ln -sv /usr/local/gcc-8.2.0/include/ /usr/include/gcc

[root@sz_jszx_cloud_dev01_17_58 build]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc-8.2.0/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/usr/local/gcc-8.2.0 --enable-bootstrap --enable-checking=release --enable-languages=c,c++ --disable-multilib
Thread model: posix
gcc version 8.2.0 (GCC) 


[opsadmin@sz_jszx_cloud_dev01_17_58 ~]$ strings /lib64/libc.so.6 | grep GLIBC
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_2.15
GLIBC_2.16
GLIBC_2.17
...
复制代码

6.编译glibc2.28

# wget http://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.gz

编译
# 编译时间较长,开启screen避免编译中断

复制代码
# screen -S glibc
# tar -xf glibc-2.28.tar.gz
# cd glibc-2.28
# mkdir build
# cd build
# 预编译
# ../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
# 多线程编译,加快编译速度
# make -j 4 && make  install

这个报错可以不用理会
LD_SO=ld-linux-x86-64.so.2 CC="gcc -B/usr/bin/" /usr/bin/perl scripts/test-installation.pl /usr/local/src/glibc-2.28/build/
/usr/bin/ld: cannot find -lnss_test2
collect2: error: ld returned 1 exit status
Execution of gcc -B/usr/bin/ failed!
The script has found some problems with your installation!
Please read the FAQ and the README file and check the following:
- Did you change the gcc specs file (necessary after upgrading from
  Linux libc5)?
- Are there any symbolic links of the form libXXX.so to old libraries?
  Links like libm.so -> libm.so.5 (where libm.so.5 is an old library) are wrong,
  libm.so should point to the newly installed glibc file - and there should be
  only one such link (check e.g. /lib and /usr/lib)
You should restart this script from your build directory after you've
fixed all problems!
Btw. the script doesn't work if you're installing GNU libc not as your
primary library!
make[1]: *** [Makefile:111: install] Error 1
make[1]: Leaving directory '/usr/local/src/glibc-2.28'
make: *** [Makefile:12: install] Error 2


复制代码

# 验证是否成功

复制代码
[root@sz_jszx_cloud_dev01_17_58 build]# strings /usr/local/gcc-8.2.0/lib64/libstdc++.so.6 | grep GLIBCXX_
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBCXX_3.4.23
GLIBCXX_3.4.24
GLIBCXX_3.4.25


[root@sz_jszx_cloud_dev01_17_58 build]#  strings /lib64/libc.so.6 | grep GLIBC
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_2.15
GLIBC_2.16
GLIBC_2.17
GLIBC_2.18
GLIBC_2.22
GLIBC_2.23
GLIBC_2.24
GLIBC_2.25
GLIBC_2.26
GLIBC_2.27
GLIBC_2.28

[root@sz_jszx_cloud_dev01_17_58 local]# ldd --version
ldd (GNU libc) 2.28
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
复制代码

 安装zlib 1.2.11

复制代码
cd /usr/local/src
wget http://zlib.net/zlib-1.2.11.tar.gz
tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure --libdir=/lib64/
make && make install

# 查看版本
strings /lib64/libz.so.1|grep ZLIB

# 删除老版本(其实可以不删除)
# rpm -qa | grep zlib | xargs  rpm -e --nodeps
# 这个可以删除
# rm -f /lib64/libz.so.1.2.7

ldconfig
ll /lib64/libz.*


rm -f /usr/local/lib/libz.so.1
ln -s /lib64/libz.so.1.2.11 /usr/local/lib/libz.so.1
复制代码

 报错:
-bash: warning: setlocale: LC_TIME: cannot change locale (en_US.UTF-8)

处理方法
vim /etc/environment

LANG=en_US.utf-8
LC_ALL=

 

gcc预编译报错记录

复制代码
checking for bison... bison
checking for python3... python3
configure: WARNING:
*** These auxiliary programs are missing or incompatible versions: makeinfo
*** some features or tests will be disabled.
*** Check the INSTALL file for required versions.
checking LD_LIBRARY_PATH variable... contains current directory
configure: error:
*** LD_LIBRARY_PATH shouldn't contain the current directory when
*** building glibc. Please change the environment variable
*** and run configure again.

解决办法:将LD_LIBRARY_PATH参数清空,然后重新source导入
[root@:/usr/local/src/glibc-2.28/build]# export LD_LIBRARY_PATH=
[root@:/usr/local/src/glibc-2.28/build]# source /etc/profile
[root@:/usr/local/src/glibc-2.28/build]# echo $LD_LIBRARY_PATH
/usr/local/gcc-8.2.0/libexec/gcc/x86_64-pc-linux-gnu/7.2.0:/usr/local/gcc-8.2.0/lib64:/usr/local/gcc-8.2.0/lib/gcc/x86_64-pc-linux-gnu/8.2.0/plugin
复制代码

 参考添加配置

复制代码
more /etc/ld.so.conf
include ld.so.conf.d/*.conf
#####ADD BY lx#####
/usr/local/BerkeleyDB-4.8.30/lib
/usr/local/lab/ltp-full-20140115/lib
/usr/local/mysql/lib
/usr/local/lab/openssl/lib
/usr/local/lab/libevent-2.0.21-stable/lib
/usr/local/so
/usr/local/lab
/usr/local/lib
/usr/lib64/mysql/
/usr/lib64/bind9-export/
/data/www/vhosts/services/cvsrv/cv_sdk/lib
/usr/local/cuda-11.0/lib64
复制代码

 报错记录2

复制代码
二、报错如下:
/data/www/vhosts/services/cvsrv/cvsrv: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /data/www/vhosts/services/cvsrv/cv_sdk/lib/libcv_sdk.so.0.7.0)
/data/www/vhosts/services/cvsrv/cvsrv: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /data/www/vhosts/services/cvsrv/cv_sdk/lib/libcv_sdk.so.0.7.0)
/data/www/vhosts/services/cvsrv/cvsrv: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /data/www/vhosts/services/cvsrv/cv_sdk/lib/libcv_sdk.so.0.7.0)
/data/www/vhosts/services/cvsrv/cvsrv: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /data/www/vhosts/services/cvsrv/cv_sdk/lib/libcv_sdk.so.0.7.0)
/data/www/vhosts/services/cvsrv/cvsrv: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /data/www/vhosts/services/cvsrv/cv_sdk/lib/libonnxruntime.so.1.7.0)
/data/www/vhosts/services/cvsrv/cvsrv: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /data/www/vhosts/services/cvsrv/cv_sdk/lib/libonnxruntime.so.1.7.0)
/data/www/vhosts/services/cvsrv/cvsrv: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /data/www/vhosts/services/cvsrv/cv_sdk/lib/libonnxruntime.so.1.7.0)
/data/www/vhosts/services/cvsrv/cvsrv: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /data/www/vhosts/services/cvsrv/cv_sdk/lib/libonnxruntime.so.1.7.0)
/data/www/vhosts/services/cvsrv/cvsrv: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /data/www/vhosts/services/cvsrv/cv_sdk/lib/libinference_engine.so)
/data/www/vhosts/services/cvsrv/cvsrv: /lib64/libstdc++.so.6: version `CXXABI_1.3.11' not found (required by /data/www/vhosts/services/cvsrv/cv_sdk/lib/libinference_engine.so)
/data/www/vhosts/services/cvsrv/cvsrv: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by /data/www/vhosts/services/cvsrv/cv_sdk/lib/libinference_engine.so)
/data/www/vhosts/services/cvsrv/cvsrv: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /data/www/vhosts/services/cvsrv/cv_sdk/lib/libinference_engine.so)
/data/www/vhosts/services/cvsrv/cvsrv: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /data/www/vhosts/services/cvsrv/cv_sdk/lib/libinference_engine_transformations.so)
/data/www/vhosts/services/cvsrv/cvsrv: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /data/www/vhosts/services/cvsrv/cv_sdk/lib/libinference_engine_transformations.so)
/data/www/vhosts/services/cvsrv/cvsrv: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /data/www/vhosts/services/cvsrv/cv_sdk/lib/libngraph.so)
/data/www/vhosts/services/cvsrv/cvsrv: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /data/www/vhosts/services/cvsrv/cv_sdk/lib/libngraph.so)
/data/www/vhosts/services/cvsrv/cvsrv: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /data/www/vhosts/services/cvsrv/cv_sdk/lib/libngraph.so)
/data/www/vhosts/services/cvsrv/cvsrv: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /data/www/vhosts/services/cvsrv/cv_sdk/lib/libnvinfer_plugin.so.8)
/data/www/vhosts/services/cvsrv/cvsrv: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /data/www/vhosts/services/cvsrv/cv_sdk/lib/libnvinfer_plugin.so.8)
/data/www/vhosts/services/cvsrv/cvsrv: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /data/www/vhosts/services/cvsrv/cv_sdk/lib/libnvinfer_plugin.so.8)
/data/www/vhosts/services/cvsrv/cvsrv: /usr/local/lib/libz.so.1: version `ZLIB_1.2.9' not found (required by /data/www/vhosts/services/cvsrv/cv_sdk/lib/libcv_sdk.so.0.7.0)


解决思路:

# find / -name "libstdc++.so*"
/usr/lib/libstdc++.so.6
/usr/lib/libstdc++.so.6.0.19
/usr/lib64/libstdc++.so.6
/usr/lib64/libstdc++.so.6.0.19

/usr/share/gdb/auto-load/usr/lib/libstdc++.so.6.0.19-gdb.pyc
/usr/share/gdb/auto-load/usr/lib/libstdc++.so.6.0.19-gdb.pyo
/usr/share/gdb/auto-load/usr/lib/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/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.py
/usr/local/cuda-11.0/nsight-systems-2020.3.2/host-linux-x64/libstdc++.so.6
/usr/local/cuda-11.0/nsight-systems-2020.3.2/target-linux-armv8/host-linux-armv8/libstdc++.so.6
/usr/local/gcc-8.2.0/lib64/libstdc++.so.6.0.25
/usr/local/gcc-8.2.0/lib64/libstdc++.so.6
/usr/local/gcc-8.2.0/lib64/libstdc++.so.6.0.25-gdb.py

# 可以看到 libstdc++.so.6 软链到了 libstdc++.so.6.0.19
[root@eus-aicloud04:~]# ll /usr/lib64/libstdc++.so.6
lrwxrwxrwx. 1 root root 19 Mar 22 00:12 /usr/lib64/libstdc++.so.6 -> libstdc++.so.6.0.19

# 解决办法,我们把libstdc++.so.6软链到更高版本的 libstdc++.so.6.0.25 中
cd /usr/lib64/
cp /usr/local/gcc-8.2.0/lib64/libstdc++.so.6.0.25 /usr/lib64/
rm -f libstdc++.so.6
ln -s libstdc++.so.6.0.25 libstdc++.so.6
复制代码

 

posted @   reblue520  阅读(11369)  评论(0编辑  收藏  举报
编辑推荐:
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· PostgreSQL 和 SQL Server 在统计信息维护中的关键差异
· C++代码改造为UTF-8编码问题的总结
阅读排行:
· 【.NET】调用本地 Deepseek 模型
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
历史上的今天:
2018-02-26 通过flask实现web页面简单的增删改查bootstrap美化版
2018-02-26 jquery简单使用入门
2018-02-26 bootstrap简单使用布局、栅格系统、modal标签页等常用组件入门
点击右上角即可分享
微信分享提示