1、下载源吗:
wget http://mirrors.ustc.edu.cn/gnu/gcc/gcc-8.5.0/gcc-8.5.0.tar.gz
解压:
tar -xf gcc-8.5.0.tar.gz
cd gcc-8.5.0
2、下载依赖:mpc mpfr gmp isl
./contrib/download_prerequisites
编译mpc:
cd mpc
mkdir build
cd build
../configure --prefix=/usr/local/mpc
编译mpfr :
cd ../../mpfr
mkdir build
cd build
../configure --prefix=/usr/local/mpfr
编译gmp:
cd ../../gmp
mkdir build
cd build
../configure --prefix=/usr/local/gmp
编译isl:
cd ../../isl
mkdir build
cd build
../configure --prefix=/usr/local/isl
3、编译gcc
cd ../..
mkdir build
cd build
../configure --prefix=/usr/local/gcc-8.5.0 --enable-languages=c,c++ --disable-multilib --with-abi=64 --with-mpfr=/usr/local/mpfr --with-mpc=/usr/local/mpc --with-mpfr=/usr/local/mpfr --with-isl=/usr/local/isl --with-gmp=/usr/local/gmp
make -j8
sudo make install