316 字
2 分钟

Centos升级glibc2.28遇到的坑

2024-05-27
浏览量 加载中...

起因#

最近在使用某程序的时候需要高版本的glibc,升级系统成本太高,遂改为研究升级glibc版本。

升级过程#

查询glibc版本:

Terminal window
strings /lib64/libc.so.6 | grep -E "^GLIBC" | sort -V -r | uniq

下载2.28版本并编译:

Terminal window
wget https://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.gz
tar -xzvf 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

安装:

Terminal window
make install>

查询是否升级成功:

Terminal window
strings /lib64/libc.so.6 | grep GLIBC

过程中遇到的坑#

第一个坑#

Terminal window
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin

提示:

Terminal window
*** These critical programs are missing or too old: make compiler

原因是make和compiler版本太低,需要进行升级

升级make:

Terminal window
wget http://ftp.gnu.org/pub/gnu/make/make-4.4.tar.gz
tar -xzvf make-4.4.tar.gz
cd make-4.4/
mkdir build&&cd build
../configure --prefix=/usr/
bash build.sh
make install

验证:

Terminal window
make --version

升级compiler:

Terminal window
yum -y install centos-release-scl
yum -y install devtoolset-8-gcc devtoolset-8-gcc-c++ devtoolset-8-binutils
scl enable devtoolset-8 bash
echo "source /opt/rh/devtoolset-8/enable" >>/etc/profile

验证:

Terminal window
gcc --version

第二个坑#

make和compiler都升级成功之后继续执行glibc升级代码,make之后开始漫长的编译,N久之后发现没动了 卡在了:

Terminal window
make[2]: Entering directory '/root/glibc-2.28/stdio-common

等待半天无果,强制中断重新make,问题依然复现,重新下载glibc2.28依然不行。 后发现问题出在make版本过高的原因,glibc2.28版本需要make版本在4.0版本以上且低于4.4版本,遂降级make,一次成功编译。

文章分享

如果这篇文章对你有帮助,欢迎分享给更多人!

Centos升级glibc2.28遇到的坑
https://blog.zwfpro.com/posts/glibc-update/
作者
赵公子
发布于
2024-05-27
许可协议
CC BY-NC-SA 4.0
最后更新于 2024-05-27,距今已过 877 天

部分内容可能已过时

评论区

Profile Image of the Author
赵公子
所见皆可记,所遇皆有意
公告
欢迎来到岁语集,这里是赵公子的博客,记录技术、生活与思考。
分类
标签
站点统计
文章
14
分类
7
标签
24
总字数
6,151
运行时长
0 天
最后活动
0 天前

目录