合 Centos升级glibc,解决version `GLIBC_2.25' not found问题
- 简介
- 现象
- 升级glibc
- 报错:These critical programs are missing or too old: make compiler
- 报错: These critical programs are missing or too old: compiler
- /lib64/libc.so.6错误或Segmentation fault (core dumped)
- -bash: warning: setlocale: LC_CTYPE: cannot change locale (en_US.UTF-8): No such file or directory
- /usr/bin/ld: cannot find -lnss_test2
- centos 7.6升级到glibc-2.28(成功)
- 总结
- 参考
简介
GLIBC介绍 glibc是GNU发布的libc库,即c运行库。glibc是linux系统中最底层的api,几乎其它任何运行库都会依赖于glibc。glibc除了封装linux操作系统所提供的系统服务外,它本身也提供了许多其它一些必要功能服务的实现。内核实现一个功能,glibc要花很久才会用上,由于glibc和内核不是一块开发的,所以glibc需要去兼容不同版本的内核,而内核也要去兼容不同版本的 glibc,双方都背负了太多的历史包袱。 GLIBC官网: http://www.gnu.org/software/libc/
现象
1 2 3 4 5 6 7 | [root@lhrdb soft]# gping 172.16.7.163 gping: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by gping) gping: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by gping) gping: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by gping) [root@lhrdb ~]# cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core) [root@lhrdb ~]# |
检查:
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 29 30 31 32 33 34 35 | [root@lhrdb soft]# rpm -qf /lib64/libc.so.6 glibc-2.17-326.el7_9.x86_64 [root@lhrdb soft]# strings /usr/lib64/libc.so.6 |grep ^GLIBC_2 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.8 GLIBC_2.5 GLIBC_2.9 GLIBC_2.7 GLIBC_2.6 GLIBC_2.11 GLIBC_2.16 GLIBC_2.10 GLIBC_2.17 GLIBC_2.13 GLIBC_2.2.6 |
确实是不存在GLIBC_2.25,接下来我们就开始安装GLIBC的新版本
升级glibc
glibc是整个系统非常基础的库,一旦出问题,则会导致系统崩溃。笔者就在容器中尝试升级到2.38,发现编译不过报错.
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 | ../sysdeps/x86_64/multiarch/strchr-evex-base.S: Assembler messages: ../sysdeps/x86_64/multiarch/strchr-evex-base.S:64: Error: no such instruction: `vpcmpneqb %zmm17,%zmm16,%k1' ../sysdeps/x86_64/multiarch/strchr-evex-base.S:124: Error: no such instruction: `vpcmpneqb %zmm17,%zmm16,%k1' ../sysdeps/x86_64/multiarch/strchr-evex-base.S:155: Error: no such instruction: `vpcmpneqb %zmm17,%zmm16,%k1' ../sysdeps/x86_64/multiarch/strchr-evex-base.S:171: Error: no such instruction: `vpcmpneqb %zmm17,%zmm16,%k1' ../sysdeps/x86_64/multiarch/strchr-evex-base.S:182: Error: no such instruction: `vpcmpneqb %zmm17,%zmm16,%k1' ../sysdeps/x86_64/multiarch/strchr-evex-base.S:193: Error: no such instruction: `vpcmpneqb %zmm17,%zmm16,%k1' ../sysdeps/x86_64/multiarch/strchr-evex-base.S:214: Error: no such instruction: `vpcmpneqb %zmm17,%zmm16,%k1' ../sysdeps/x86_64/multiarch/strchr-evex-base.S:215: Error: no such instruction: `vpcmpneqb %zmm18,%zmm16,%k2' ../sysdeps/x86_64/multiarch/strchr-evex-base.S:219: Error: no such instruction: `vpcmpneqb %zmm19,%zmm16,%k3{%k1}' ../sysdeps/x86_64/multiarch/strchr-evex-base.S:220: Error: no such instruction: `vpcmpneqb %zmm20,%zmm16,%k4{%k2}' ../sysdeps/x86_64/multiarch/strchr-evex-base.S: Assembler messages: ../sysdeps/x86_64/multiarch/strchr-evex-base.S:64: Error: no such instruction: `vpcmpneqb %zmm17,%zmm16,%k1' ../sysdeps/x86_64/multiarch/strchr-evex-base.S:124: Error: no such instruction: `vpcmpneqb %zmm17,%zmm16,%k1' ../sysdeps/x86_64/multiarch/strchr-evex-base.S:155: Error: no such instruction: `vpcmpneqb %zmm17,%zmm16,%k1' make[2]: *** [/soft/glibc-2.38/build/sysd-rules:653: /soft/glibc-2.38/build/string/strchr-evex512.o] Error 1 ../sysdeps/x86_64/multiarch/strchr-evex-base.S:171: Error: no such instruction: `vpcmpneqb %zmm17,%zmm16,%k1' ../sysdeps/x86_64/multiarch/strchr-evex-base.S:182: Error: no such instruction: `vpcmpneqb %zmm17,%zmm16,%k1' ../sysdeps/x86_64/multiarch/strchr-evex-base.S:193: Error: no such instruction: `vpcmpneqb %zmm17,%zmm16,%k1' ../sysdeps/x86_64/multiarch/strchr-evex-base.S:214: Error: no such instruction: `vpcmpneqb %zmm17,%zmm16,%k1' ../sysdeps/x86_64/multiarch/strchr-evex-base.S:215: Error: no such instruction: `vpcmpneqb %zmm18,%zmm16,%k2' ../sysdeps/x86_64/multiarch/strchr-evex-base.S:219: Error: no such instruction: `vpcmpneqb %zmm19,%zmm16,%k3{%k1}' ../sysdeps/x86_64/multiarch/strchr-evex-base.S:220: Error: no such instruction: `vpcmpneqb %zmm20,%zmm16,%k4{%k2}' make[2]: *** [/soft/glibc-2.38/build/sysd-rules:653: /soft/glibc-2.38/build/string/strchrnul-evex512.o] Error 1 ../sysdeps/x86_64/multiarch/memchr-evex-base.S:229: Error: no such instruction: vpcmpneqb (64 * 4)(%rdi),%zmm17,%k1', |
2.36、2.37都是这样的错。
2.38在添加了参数 --disable-sanity-checks --disable-werror
后编译通过了,但是安装后,常用的命令都不能使用了,不兼容,系统崩溃,不能再启动。所以一定要慎重升级glibc库,特别是物理机上。
下载地址: http://ftp.gnu.org/gnu/glibc/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | wget http://ftp.gnu.org/gnu/glibc/glibc-2.38.tar.xz -- wget https://mirrors.cloud.tencent.com/gnu/glibc/glibc-2.28.tar.gz tar -xvf glibc-2.38.tar.xz cd glibc-2.38 mkdir build cd build ../configure --prefix=/usr/local/glibc2.38 \ --disable-profile --enable-add-ons --with-headers=/usr/include \ --with-binutils=/usr/bin --disable-sanity-checks --disable-werror --disable-option-checking make -j32 make install echo '/usr/local/glibc2.38/lib/' >> /etc/ld.so.conf ldconfig ldconfig -v|grep libc.so.6 strings /usr/lib64/libc.so.6 |grep ^GLIBC_2 | grep 38 |
而rpm包对于centos来说,最高才是2.17版本。
报错:These critical programs are missing or too old: make compiler
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 | make -v [root@lhrdb soft]# which make /usr/bin/make [root@lhrdb soft]# rpm -qf /usr/bin/make make-3.82-24.el7.x86_64 [root@lhrdb soft]# http://ftp.gnu.org/pub/gnu/make/ 查找最新安装包 wget http://ftp.gnu.org/pub/gnu/make/make-4.4.tar.gz tar -zxvf make-4.4.tar.gz cd make-4.4 mkdir build cd build ../configure --prefix=/usr/local/make4.4 sh build.sh make install /usr/local/make4.4/bin/make -v mv /usr/bin/make /usr/bin/make_bk ln -sf /usr/local/make4.4/bin/make /usr/bin/make export PATH=/usr/local/make4.4/bin:$PATH |
报错: These critical programs are missing or too old: compiler
gcc版本太低,升级gcc
1 2 3 4 5 | yum install centos-release-scl -y yum install -y devtoolset-8-gcc devtoolset-8-gcc-c++ devtoolset-8-binutils devtoolset-8-libstdc++-devel devtoolset-8-runtime scl-utils echo "source /opt/rh/devtoolset-8/enable" >> /etc/profile echo "source /opt/rh/devtoolset-8/enable" >> /root/.bashrc source /etc/profile |
编译升级:
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 29 30 31 32 33 34 | gcc -v yum -y install bzip2 #已安装可以跳过这一步 # 中标麒麟系统需要以下依赖 # yum -y install gmp mpfr mpc isl bzip2 -- wget http://ftp.gnu.org/gnu/gcc/gcc-13.2.0/gcc-13.2.0.tar.gz wget https://mirrors.cloud.tencent.com/gnu/gcc/gcc-13.2.0/gcc-13.2.0.tar.gz tar -zxvf gcc-13.2.0.tar.gz cd gcc-13.2.0/ ./contrib/download_prerequisites mkdir build cd build/ ../configure --prefix=/usr/local/gcc1320 -enable-checking=release -enable-languages=c,c++ -disable-multilib # --prefix=/usr/local 配置安装目录 #–enable-languages表示你要让你的gcc支持那些语言, #–disable-multilib不生成编译为其他平台可执行代码的交叉编译器。 #–disable-checking生成的编译器在编译过程中不做额外检查, #也可以使用*–enable-checking=xxx*来增加一些检查 # 该步骤很耗时 make -j 32 make install gcc -v /usr/local/gcc1320/bin/gcc -v mv /usr/bin/gcc /usr/bin/gcc_bk mv /usr/bin/g++ /usr/bin/g++_bk ln -s /usr/local/gcc1320/bin/gcc /usr/bin/gcc ln -s /usr/local/gcc1320/bin/g++ /usr/bin/g++ |
/lib64/libc.so.6错误或Segmentation fault (core dumped)
relocation error: /lib64/libc.so.6: symbol _dl_audit_symbind_alt, version GLIBC_PRIVATE not defined in file ld-linux-x86-64.so.2 with link time reference
解决:
1 2 3 4 5 | sln /lib64/libc-2.17.so /lib64/libc.so.6 ldconfig -lv /lib64/libc-2.17.so export LD_LIBRARY_PATH= |
https://blog.csdn.net/qq_29695701/article/details/87724725
错误“Segmentation fault (core dumped)”多半是因为编译没有编译到默认路径--prefix=/usr目录下。
总结: 文件/lib64/libc.so.6
千万不要随意手动去修改。。。