Centos7升级make和gcc版本到最新

Background

遇到如下的问题可能就是你make和gcc的版本过低了,需要升级。

*** These critical programs are missing or too old: make compiler
*** Check the INSTALL file for required versions.

1、更新make版本

# 下载
wget https://ftp.gnu.org/pub/gnu/make/make-4.4.tar.gz
# 解压配置
tar zxf make-4.4.tar.gz
cd make-4.4
./configure --prefix=/usr
type make
make check
make install
# 验证版本
make -v

在这里插入图片描述

2、更新gcc版本

# 下载
wget https://ftp.gnu.org/gnu/gcc/gcc-12.2.0/gcc-12.2.0.tar.gz
# 解压
tar zxf gcc-12.2.0.tar.gz
# 下载依赖及配置文件
yum -y install bzip2
cd gcc-12.2.0
./contrib/download_prerequisites
mkdir build
cd build/
../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib
# 这个时间有点长啊
make -j$(nproc)
make install
# 验证版本
gcc -v

在这里插入图片描述

3、make、gcc、glibc兼容安装

  • 有时太新的也不行,各个软件版本不兼容,所以安装时还得相互兼容才行,我这里给一个测试通过的
  • 升级降级都可以这样操作
  • gcc-8.3.1
yum -y install centos-release-scl
yum -y install devtoolset-8-gcc*
# 临时生效
source /opt/rh/devtoolset-8/enable
# 永久生效
rm -rf /usr/bin/gcc /usr/bin/g++
ln -s /opt/rh/devtoolset-8/root/bin/gcc /usr/bin/gcc
ln -s /opt/rh/devtoolset-8/root/bin/g++ /usr/bin/g++

在这里插入图片描述

  • make-4.2
wget http://ftp.gnu.org/gnu/make/make-4.2.tar.gz
tar -zxf make-4.2.tar.gz
cd make-4.2
./configure
make -j$(nproc)
make install
rm -rf /usr/bin/make
cp ./make /usr/bin/
make -v

在这里插入图片描述

  • glibc-2.28
# 在线安装
wget https://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.gz
# 解压
tar zxf glibc-2.28.tar.gz
cd glibc-2.28
# 选则使用的字符集,其他没用的就不要
egrep '^SUPPORTED-LOCALES|^zh_CN' localedata/SUPPORTED > tmp && cat tmp > localedata/SUPPORTED
mkdir build
cd build
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
# 这步执行时间依赖你的配置,我的八核的几分钟就好了
make -j$(nproc)
make install
# 不然中文乱码
make localedata/install-locales
ll /lib64/libc.so.6*
strings /lib64/libc.so.6 | grep ^GLIBC
ldd --version
  • 【报错处理】These critical programs are missing or too old: bison
# 查看版本
bison -V
yum install bison -y

在这里插入图片描述

  • 【报错处理】LD_LIBRARY_PATH shouldn't contain the current directory
export LD_LIBRARY_PATH=

在这里插入图片描述

  • 【报错处理】这个报错可以不用理会,这只是一个测试nss的静态库,可以不要

LD_SO=ld-linux-x86-64.so.2 CC=“gcc -B/usr/bin/” /usr/bin/perl scripts/test-installation.pl /usr/local/src/glibc-2.28/build/
/usr/bin/ld: cannot find -lnss_test2
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/src/glibc-2.28’
    make: *** [Makefile:12: install] Error 2

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

  • 8
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

WaiSaa

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值