Anolis8/centos8/龙蜥8 升级glibc 2.30

背景:

Anolis8/centos8/龙蜥8 系统自带的glibc是2.28版本,已经无法满足项目需要,所以将glibc版本升级到2.30。

编译升级安装

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 --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin --disable-sanity-checks --disable-werror
make -j32
make install
#最后使用ldd 查看版本
ldd --version

当然也遇到了问题。。。

Q&A

1、configure 阶段报错LD_LIBRARY_PATH

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.

解决方案:
1)先将自己的LD_LIBRARY_PATH 备份保存下来

echo $LD_LIBRARY_PAT

2)再将LD_LIBRARY_PATH 清空

export LD_LIBRARY_PATH=

3)等到配置结束之后再去还原

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:库文件路径

2、编译阶段出现问题

/usr/bin/ld: cannot find -lnss_nis
/usr/bin/ld: cannot find -lnss_nisplus
/usr/bin/ld: cannot find -lnsl

解决方案:
1)打开glibc-2.30/scripts/test-installation.pl
2) 替换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" ) {

参考链接

https://blog.csdn.net/carefree2005/article/details/117559312
https://hexo.ittwtti.com/posts/56202/index.html
https://www.linuxquestions.org/questions/linux-from-scratch-13/book-8-4-%7C-section-6-9-glibc-2-29-make-error-cannot-find-lnss_nisplus-4175660125/