1、 首先下载对应版本的安装包
# wget https://ftp.gnu.org/gnu/glibc/glibc-2.23.tar.gz
1
2、解压、新建编译目录目录
# tar xf glibc-2.23.tar.gz
# cd glibc-2.23/
# mkdir glibc-build
# cd glibc-build (一定要在新建的目录中操作)
echo $LD_LIBRARY_PATH
LD_LIBRARY_PATH=
3、安装
# ../configure --prefix=/usr
# make
# make install
1
2
3
在make install 时可能会跳出错误(类似的应该是因为软链接的版本不对造成的)
gawk '/\.gnu\.glibc-stub\./ { \
sub(/\.gnu\.glibc-stub\./, "", $2); \
stubs[$2] = 1; } \
END { for (s in stubs) print "#define __stub_" s }' > /root/glibc-2.23/glibc-build/math/stubsT
gawk: error while loading shared libraries: /lib64/libm.so.6: invalid ELF header
make[2]: *** [/root/glibc-2.23/glibc-build/math/stubs] Error 127
make[2]: Leaving directory `/root/glibc-2.23/math'
make[1]: *** [math/subdir_install] Error 2
make[1]: Leaving directory `/root/glibc-2.23'
make: *** [install] Error 2
1
2
3
4
5
6
7
8
9
10
解决办法(在另外的窗口执行):
# cd /lib64
# unlink libm.so.6
# ln -s libm-2.23.so libm.so.6
1
2
3
然后再次执行make install
看到如下信息就是安装成功了
LD_SO=ld-linux-x86-64.so.2 CC="gcc" /usr/bin/perl scripts/test-installation.pl /root/glibc-2.23/glibc-build/
Your new glibc installation seems to be ok.
make[1]: Leaving directory `/root/glibc-2.23'
1
2
3
4、验证
# ldd --version
ldd (GNU libc) 2.23
Copyright (C) 2016 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.
1
2
3
4
5
6
升级成功!
————————————————
版权声明:本文为CSDN博主「Little Programmer」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_20989105/article/details/90712139