参考:https://www.cnblogs.com/tankblog/p/6096681.html
参考:https://blog.csdn.net/qq_33438733/article/details/79983141
1、下载依赖包
编译安装 GCC 需要依赖 mpc,mpfr,gmp包。好在 GCC 源码里自带脚本可以轻松下载依赖包。
./contrib/download_prerequisites
2、编译安装
mkdir build;cd build
../configure --prefix=/home/mrc/.software/gcc/gcc-installpath-6.4.0/
第一次出现了如下错误:
configure: error: I suspect your system does not have 32-bit development libraries (libc and headers). If you have them, rerun configure with --enable-multilib. If you do not have them, and want to build a 64-bit-only compiler, rerun configure with --disable-multilib.
于是
../configure --prefix=/home/mrc/.software/gcc/gcc-installpath-6.4.0/ --disable-multilib
成功执行configure
make -j 8 #编译过程 巨长
make install