阿里龙蜥Anolis8升级glibc2.29

写在开头: 根据网上繁多文章整理自己遇到的问题给大家避免踩到相同坑

 

因为国产化的需求, 公司使用了龙蜥Anolis8操作系统,但系统自带的glibc2.28遇到一个应用需要升级, yum无法升级需要源码编译升级

 

编译升级安装

wget https://mirrors.aliyun.com/gnu/glibc/glibc-2.30.tar.gz
tar -xvf glibc-2.30.tar.gz
#查看glibc需要的gcc,make,python,camke等等库是否满足要求
cat INSTALL |grep -E "later|newer"


cd glibc-2.30

mkdir -p build && cd build
../configure --prefix=/usr CFLAGS="-g -O2 -fPIC -funwind-tables"

编译
make -j4

 

避免失败提前修改源码

打开glibc-2.30/scripts/test-installation.pl

将原先替换128行的

&& $name ne "nss_test1" && $name ne "libgcc_s") {

修改为:

&& $name ne "nss_test1" && $name ne "nss_test2" && $name ne "nss_nis" && $name ne "nss_nisplus" && $name ne "libgcc_s" && $name ne "nsl" ) {

 

安装

make install

 

验证

#最后使用ldd 查看版本
ldd --version

ldd (GNU libc) 2.29
Copyright (C) 2019 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.


或者
strings /lib64/libc.so.6 |egrep '^GLIBC_'

能看到GLIBC_2.29表示升级成功

 

FAQ

1、 安装目录直接使用/usr, 不必ldconfig配置, 减少出错

2、 误删除软链接 /lib64/libc.so.6, 使用ldconfig -l -v /lib64/libc-2.28.so 恢复

3、 遇到“段错误 (核心已转储)”等编译安装完出错请参考2, 恢复libc.so.6

 

参考链接:

1、 https://hexo.ittwtti.com/posts/56202/index.html

2、 https://blog.csdn.net/SHAOYEZUIZUISHAUI/article/details/135283978

 

posted @ 2024-07-02 11:15  梁一凡  阅读(313)  评论(0)    收藏  举报