dependencies
yum install gmp-devel mpfr-devel libmpc-devel gcc gcc-c++
编译&安装
# 打开编译go功能需先部署go安装包
tar xvf gcc-9.2.0.tar.xz
cd gcc-9.2.0
./contrib/download_prerequisites
cd ..
mkdir objdir && cd objdir
$PWD/../gcc-9.2.0/configure --prefix=/usr/local/gcc-9.2.0 --enable-languages=c,c++,go --disable-multilib
#--disable-multilib 不编译32位库
make
make install
替换系统gcc c++
rm -rf /usr/bin/cc
rm -rf /usr/bin/c++
ln -s /usr/local/gcc-9.2.0/bin/gcc /usr/bin/cc
ln -s /usr/local/gcc-9.2.0/bin/cpp /usr/bin/c++
验证gcc版本
cc --version
c++ --version