下载gcc源码 gcc-10.2.0.tar.gz
解压完进入到源码目录
./contrib/download_prerequisites
mkdir build && cd build
../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
make -j 32 && make install
编译完的目录在 /usr/local/bin 目录下
修改软链接:
yum remove g++
yum remove gcc
ln -s /usr/local/bin/gcc ./gcc
ln -s /usr/local/bin/g++ ./g++