背景:
在编译软件的时,会出现上述错误,说明系统中GLIBC版本过低,需要升级该GLIBC;
一、解决方法
1、升级操作系统
直接安装Centos 8 系统或者升级Centos 7系统到Centos8 ,(升级之前需要备份重要数据)
2、安装升级GLIBC_2.9
(此操作危险,需要动系统默认库操作需谨慎,最好在测试环境模拟一次)
2.1 安装GLIBC_2.9
安装必要环境:组件gcc 8.0 make 4.0 python 3.0 bison
安装gcc 8.0
yum install -y centos-release-scl
yum install -y devtoolset-8-gcc*
mv /usr/bin/gcc /usr/bin/gcc-4.8.5
ln -s /opt/rh/devtoolset-8/root/bin/gcc /usr/bin/gcc
mv /usr/bin/g++ /usr/bin/g++-4.8.5
ln -s /opt/rh/devtoolset-8/root/bin/g++ /usr/bin/g++
安装make 4.0
wget http://ftp.gnu.org/gnu/make/make-4.3.tar.gz
tar -xzvf make-4.3.tar.gz && cd make-4.3/
./configure --prefix=/usr/local/make
make && make install
cd /usr/bin/ && mv make make.bak
ln -sv /usr/local/make/bin/make /usr/bin/make
安装python 3.0
Centos 7系统默认带2.0的python ,有一些应用需要升级到3.0,我们这次升级到python 3.0
yum install gcc gcc-c++ libffi-devel openssl-devel python-setuptools vim wget make sqlite-devel zlib* -y #安装python 常用环境依赖
https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz #下载Python 3.5.1 安装包,可根据自己希求下对应版本
tar xzvf Python-3.5.1.tgz #解压缩软件
cd Python-3.5.1
./configure --with-ssl
make #编译
make install #安装
ls -al /usr/bin | grep python #查看当前python 版本
mv /usr/bin/python /usr/bin/python.bak #python 的软链接重命名
ln -s /usr/local/bin/python3 /usr/bin/python #将 python 链接至 python3:
配置yum
升级 Python 之后,由于将默认的 python 指向了 python3,yum 不能正常使用
修改/usr/bin/yum #!/usr/bin/python 修改成python2.7
修改/usr/libexec/urlgrabber-ext-down #!/usr/bin/python 修改成python2.7
安装 bison
yum -y install bison #安装bison
2.2编译安装GLIBC
下载GLIBC安装包:
cd
wget http://ftp.gnu.org/gnu/glibc/glibc-2.29.tar.gz
tar xzvf glibc-2.29.tar.gz
cd glibc-2.29/ && mkdir build && cd build
cd ~/glibc-2.29/build # 配置环境
../configure --prefix=/usr --disable-profile --enable-add-ons --enable-obsolete-nsl --with-headers=/usr/include --with-binutils=/usr/bin --disable-sanity-checks --disable-werror
make #编译
make install #编译安装
2.3 查看版本
ldd --version