centos7.9下升级gcc版本

参考:

GLIBCXX_3.4.21' not found问题小记_wiggens的博客-CSDN博客

Centos /lib64/libc.so.6: version `GLIBC_2.28‘ not found (required by_version `glibc_2.28' not found_Lemonary.的博客-CSDN博客

CentOS7升级GCC版本,解决version `GLIBCXX_3.4.21‘ not found_那一片海的博客-CSDN博客

Centos 7 升级 Glibc-2.28-腾讯云开发者社区-腾讯云

OSError: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by xxx.so) ——升级GLIBC并解决系统错误 - 知乎

​
yum install -y centos-release-scl

yum install -y bison devtoolset-8-gcc devtoolset-8-gcc-c++ devtoolset-8-binutils

scl enable devtoolset-8 bash

echo "source /opt/rh/devtoolset-8/enable" >>/etc/profile

 更新make

wget https://ftp.gnu.org/gnu/make/make-4.3.tar.gz
tar zxvf make-4.3.tar.gz

cd make-4.3 && ./configure --prefix=/data/local/make-4.3 && make && make install

mv /usr/bin/make /usr/bin/make.bak && ln -s /data/local/make-4.3/bin/make /usr/bin/make

安装glibc

wget https://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.xz
xz -d glibc-2.28.tar.xz && tar xvf glibc-2.28.tar && cd glibc-2.28

#也可以用-with-binutils=/opt/rh/devtoolset-8/root/usr/bin
mkdir build && cd build && ../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin --disable-sanity-checks --disable-werror
 --enable-obsolete-nsl
make

sed -i '128i\        && $name ne "nss_test2"' ../scripts/test-installation.pl

make install

strings /usr/lib64/libc.so.6 | grep ^GLIBC

安装gcc,换用跟glibc-2.28发布时间差不多的版本gcc-8.3.0

wget https://ftp.gnu.org/gnu/gcc/gcc-12.3.0/gcc-12.3.0.tar.xz
xz -d gcc-12.3.0.tar.xz && tar xvf gcc-12.3.0.tar && cd gcc-12.3.0

wget https://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.2.1.tar.bz2
wget https://gcc.gnu.org/pub/gcc/infrastructure/mpfr-4.1.0.tar.bz2
wget https://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.2.1.tar.gz
wget https://gcc.gnu.org/pub/gcc/infrastructure/isl-0.24.tar.bz2

tar jxvf gmp-6.2.1.tar.bz2 && tar jxvf mpfr-4.1.0.tar.bz2 && tar zxvf mpc-1.2.1.tar.gz && tar jxvf isl-0.24.tar.bz2

cd gmp-6.2.1 && ./configure && make && make install && cd ..
cd mpfr-4.1.0 && ./configure && make && make install && cd ..
cd mpc-1.2.1 && ./configure && make && make install && cd ..
cd isl-0.24 && ./configure && make && make install && cd ..

echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig -v

mkdir build && cd build

../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib

make && make install

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值