2. 解压安装:安装有先后顺序:GMP、MPFR、MPC、GCC
2.1 安装gmp
tar jxf gmp-*.*.*.tar.bz2
cd gmp-*.*.*/
./configure --prefix=/usr/local/gmp/
make
make install
2.2 安装MPFR:cd ../
tar jxf mpfr-*.*.*.tar.bz2
cd mpfr-*.*.*/
./configure --prefix=/usr/local/mpfr --with-gmp=/usr/local/gmp
make
make install
2.3 安装MPC:cd ../
tar xzf mpc-*.*.*.tar.gz
cd mpc-*.*.*
./configure --prefix=/usr/local/mpc --with-mpfr=/usr/local/mpfr --with-gmp=/usr/local/gmp
make
make install
3. vim /etc/profile 加入 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mpc/lib:/usr/local/gmp/lib:/usr/local/mpfr/lib4. source /etc/profile
5. 安装gcc(安装c和c++的静态库: yum install glibc-static libstdc++-static -y (保险起见))
5.1 cd ../
tar -jxvf gcc-*.*.*.tar.bz2
cd gcc-*.*.*
mkdir gcc-build-*.*.*
cd gcc-build-*.*.*
../configure --prefix=/usr/local/gcc --enable-threads=posix --disable-checking --disable-multilib --enable-languages=c,c++ --with-gmp=/usr/local/gmp --with-mpfr=/usr/local/mpfr --with-mpc=/usr/local/mpc
make
make install
6. 创建软连接ln -s /usr/local/gcc/bin/gcc /usr/bin/gcc
ln -s /usr/local/gcc/bin/g++ /usr/bin/g++
7. 测试
gcc -v