ActPi向阳技术栈
← 返回文章列表

升级 glibc 解决 `GLIBC_2.28` not found (required by xxx)

文章目录
  1. 升级 gcc
  2. 升级 make
  3. 升级glibc

默认的gcc版本是4.8.5,无法编译高版本的glibc 2.28,需要升级到gcc 8以上的版本

升级 gcc

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
查看是否升级成功
gcc  --version

升级 make

注意:make 的版本高于4.4 会造成 glibc 编译时卡在这一行

make[2]: Entering directory '/root/glibc-2.28/stdio-common 所以安装 make 4.2 的版本即可

wget http://ftp.gnu.org/pub/gnu/make/make-4.2.tar.gz
tar -xzvf make-4.2.tar.gz
cd make-4.2/
mkdir build && cd build
../configure --prefix=/usr/
make
make install
# 删除旧的 make
rm /usr/bin/make
# 拷贝新的
cp make /usr/bin/

升级glibc

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
make install

查询是否升级成功: strings /lib64/libc.so.6 | grep GLIBC