下载说明
因本次用到 gcc 4.9.4版本,故以该版本为例
包含
1.gmp-6.1.2.tar.bz2
2.mpfr-4.0.1.tar.gz
3.mpc-1.1.0.tar.gz
4.isl-0.20.tar.gz
5.gcc-4.9.4.tar.gz
1.下载解压 gcc 合集
wget http://data.ieg123.com/csdn/linux/centos/gcc_c_11.tar.gz
tar -zxvf gcc_c_11.tar.gz
2.解压安装 gmp
tar -jxvf gmp-6.1.2.tar.bz2
./configure --prefix=/usr/local/gmp-6.1.2
make && make install
3.解压安装 mpfr
tar -zxvf mpfr-4.0.1.tar.gz
./configure --prefix=/usr/local/mpfr-4.0.1 --with-gmp=/usr/local/gmp-6.1.2
make && make install
4.解压安装 mpc
tar -zxvf mpc-1.1.0.tar.gz
./configure --prefix=/usr/local/mpc-1.1.0 --with-gmp=/usr/local/gmp-6.1.2 --with-mpfr=/usr/local/mpfr-4.0.1
make && make install
5.解压安装 isl (可不安装)
./configure
make && make install
6.解压安装 gcc
tar -zxvf gcc-4.9.4.tar.gz
./configure -enable-checking=release -enable-languages=c,c++ -disable-multilib --with-gmp=/usr/local/gmp-6.1.2 --with-mpfr=/usr/local/mpfr-4.0.1 --with-mpc=/usr/local/mpc-1.1.0
make -j4 /*4线程编译*/ && make install
安装好后 gcc -v 查看版本即可
gcc make报错:
configure: error: cannot compute suffix of object files: cannot compile
在/etc/profile文件末尾加上:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mpc-1.1.0/lib:/usr/local/gmp-6.1.2/lib:/usr/local/mpfr-4.0.1/lib
注意修改目录,之后运行#source /etc/profile使其生效即可
参考
https://www.jianshu.com/p/e8fd6a243a56
https://zhidao.baidu.com/question/174122469.html