最近在测试一个wiki应用时候遇到启动时候报错:****: /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升级过程没什么好说的,就是下载,解压,编译安装,验证版本。
yum install -y bison安装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
3 条评论
[root@fileServer glibc-2.28]# make
Makeconfig:42: *** 遗漏分隔符 遗漏分隔符 %s。 停止。
每次make都是这个问题,把gcc升级到8.3.1,又换成8.2,都是一样的结果。
看到另一篇博客 【升级glibc版本2.18】(https://blog.51cto.com/feirenraoyuan/5354600)给了一点触动,所以直接下载glibc的rpm文件,直接rpm安装
glibc: wget https://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/glibc-2.28-164.el8.x86_64.rpm
glibc-devel: wget https://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/glibc-devel-2.28-164.el8.x86_64.rpm
glibc-common:wget https://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/glibc-common-2.28-164.el8.x86_64.rpm
glibc-headers: wget https://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/glibc-headers-2.28-164.el8.x86_64.rpm
glibc-lang: wget https://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/glibc-lang-all-2.28-164.el8.x86_64.rpm
rpm -Uvh --nodeps glibc-2.28-164.el8.x86_64.rpm glibc-common-2.28-164.el8.x86_64.rpm glibc-devel-2.28-164.el8.x86_64.rpm glibc-headers-2.28-164.el8.x86_64.rpm glibc-all-langpacks-2.28-164.el8.x86_64.rpm
原作中 --aid 参数无效,直接去掉了。
这样就可以免去编译之苦。至于后续有没有什么其他问题,新手暂无可知。
make你安装的是什么版本呢?
libcrypt.so.1没了