Background
遇到如下的问题可能就是你make和gcc的版本过低了,需要升级。
*** These critical programs are missing or too old: make compiler
*** Check the INSTALL file for required versions.
1、更新make版本
- 下载最新版本
【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版本
- 下载最新版本
【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 -j8
make install
# 验证版本
gcc -v
3、make、gcc、glibc兼容安装
- 有时太新的也不行,各个软件版本不兼容,所以安装时还得相互兼容才行,我这里给一个测试通过的
- 升级降级都可以这样操作
gcc-8.3.1
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
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
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
mkdir build
cd build
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
# 这步执行时间依赖你的配置,我的八核的几分钟就好了
make -j8
make install
这个报错可以不用理会,这只是一个测试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