一:gdb升级到gdb-12.1
yum install binutils texinfo bison gettext
yum install gcc-c++
yum install gmp-devel.x86_64
wget http://ftp.gnu.org/gnu/gdb/gdb-12.1.tar.gz
tar -zxvf gdb-12.1.tar.gz
cd gdb-12.1
mkdir build
../configure --prefix=/usr
make
make install
报错:missing: line 81: makeinfo: command not found
解决方法: yum -y install texinfo
二:gcc升级到gcc-11.2
#下载软件包
wget https://mirrors.aliyun.com/gnu/gcc/gcc-11.2.0/gcc-11.2.0.tar.gz
#解压依赖包
tar -zxf gcc-11.2.0.tar.gz
cd gcc-11.2.0/
#下载4个依赖包
./contrib/download_prerequisites
#预编译
mkdir build
cd build
../configure --enable-checking=release --enable-language=c,c++ --disable-multilib --prefix=/usr
#查看cpu核数
cat /proc/cpuinfo| grep “processor”| wc -l
#-j4中的数字为cpu核数,及并发工作任务数量,可以提高编译效率
make -j4
#编译安装
make install
#检查gcc版本
[root@s144 build]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/9.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: …/configure --enable-checking=release --enable-language=c,c++ --disable-multilib --prefix=/usr
Thread model: posix
gcc version 11.2.0 (GCC)
三:升级make到4.3
[root@Subnet-100-223 ~]# wget https://mirrors.aliyun.com/gnu/make/make-4.3.tar.gz
[root@Subnet-100-223 ~]# tar -zxf make-4.3.tar.gz
[root@Subnet-100-223 ~]# cd make-4.3/
[root@Subnet-100-223 make-4.3]# mkdir build
[root@Subnet-100-223 build]# cd build
[root@Subnet-100-223 build]# ../configure --prefix=/usr
[root@Subnet-100-223 build]#make
[root@Subnet-100-223 build]#make install
…
[root@Subnet-100-223 build]# make -v
GNU Make 4.3
四:升级glibc2.33
glibc2.33对应gcc-11.2.0版本
这个版本必须对应,不然会安装失败
wget https://mirrors.aliyun.com/gnu/glibc/glibc-2.33.tar.gz
tar -zxvf glibc-2.31.tar.gz
yum -y install bison
[root@Subnet-100-223 glibc-2.33]# mkdir build;cd build/
[root@Subnet-100-223 build]# ../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin --disable-sanity-checks --disable-werror
[root@Subnet-100-223 build]# make
[root@Subnet-100-223 build]# make install
#安装locale
[root@Subnet-100-223 build]# make localedata/install-locales
[root@Subnet-100-223 build]# strings /lib64/libc.so.6 | grep GLIBC