关于/lib64/libc.so.6: version `GLIBC_2.28' not found报错修复

最近在升级ALIST应用时候遇到启动时候报错:
****: /lib64/libc.so.6: version GLIBC_2.28' not found (required by ./****)

由于自带的GLIBC版本太低,CentOS7默认最高为2.17,需要通过编译方式升级GLIBC。
升级GLIBC之前先需要升级make,并且安装bison,如果不升级make,不安装bison,那么在编译编译器时候会报错
make bison compiler

第一步先行scl源

yum -y install centos-release-scl
yum -y install devtoolset-8-gcc devtoolset-8-gcc-c++ devtoolset-8-binutils
scl enable devtoolset-8 bash
#如果使用的是zsh,那么修改最后的bash为zsh


第二步升级make

以make4.2为例

wget http://ftp.gnu.org/gnu/make/make-4.2.tar.gz
tar -xzvf make-4.2.tar.gz
cd make-4.2
sudo ./configure
sudo make
sudo make install
sudo rm -rf /usr/bin/make
sudo cp ./make /usr/bin/
make -v

升级过程没什么好说的,就是下载,解压,编译安装,验证版本。


安装bison

yum install -y bison

第三步升级glibc

wget http://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.gz
#这里或者访问http://ftp.gnu.org/gnu/glibc/ 下载其他版本
tar -zxvf glibc-2.28.tar.gz -C /usr/local/
#官方推荐安装到/usr/local/目录下
cd /usr/local/glibc-2.28
mkdir build && cd build
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
make && make install
#make过程会比较长,根据服务器性能不同而不同,我在虚拟机里面是编译了将近半小时。
strings /lib64/libc.so.6|grep ^GLIBC
ls -l /lib64/libc.so.6
#检查下libc.so.6是否为2.28版本

到这里就完成了。

在编译安装过程中,你可能会遇到一下报错,我多番查找无法解决这个报错,实际操作发现报错不影响glibc升级。

以下为报错的信息,请勿执行,只做演示

collect2: error: ld returned 1 exit status
Execution of gcc -B/usr/bin/ failed!
The script has found some problems with your installation!
Please read the FAQ and the README file and check the following:
- Did you change the gcc specs file (necessary after upgrading from
  Linux libc5)?
- Are there any symbolic links of the form libXXX.so to old libraries?
  Links like libm.so -> libm.so.5 (where libm.so.5 is an old library) are wrong,
  libm.so should point to the newly installed glibc file - and there should be
  only one such link (check e.g. /lib and /usr/lib)
You should restart this script from your build directory after you've
fixed all problems!
Btw. the script doesn't work if you're installing GNU libc not as your
primary library!
make[1]: *** [Makefile:111: install] Error 1
make[1]: Leaving directory '/usr/local/glibc-2.28'
make: *** [Makefile:12:install] 错误 2


作者头像
哆哆盘创始人

上一篇:anycast
下一篇:实现某东商城某商品评论数据的爬取(评论数据不少于100条,包括评论内容、时间和评分)

发表评论

https://s.click.taobao.com/CfzAAut