1.准备工作
yum install wget yum install make yum -y install bzip2 yum install m4 yum install gcc gcc-c++ glibc-static -y //安装旧的gcc相关的编译工具
2.下载gcc 4.8.2源代码
wget http://gcc.gnu.org/pub/gcc/releases/gcc-4.8.2/gcc-4.8.2.tar.bz2
3.解压缩源代码包,进入gcc-4.8.2目录,执行./contrib/download_prerequisities脚本会自动下载三个依赖库别为gmp-4.3.2、mpfr-2.4.2、mpc-0.8.1
4.安装gmp,mpfr,mpc
cd gmp mkdir build cd build ../configure --prefix=/usr/local/gcc/gmp-4.3.2 make && make install
cd ../../mpfr mkdir build cd build ../configure --prefix=/usr/local/gcc/mpfr-2.4.2 --with-gmp=/usr/local/gcc/gmp-4.3.2 make && make install
cd ../../mpc mkdir build cd build ../configure --prefix=/usr/local/gcc/mpc-0.8.1 --with-mpfr=/usr/local/gcc/mpfr-2.4.2 --with-gmp=/usr/local/gcc/gmp-4.3.2 make && make install