先安装gmp,mpfr,mpc三个包
安装gmp包:
wget https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz tar xvf gmp-6.1.2.tar.xz cd gmp-6.1.2 ./configure –prefix=/usr/local/gmp make && make install
安装mpfr包:
wget https://www.mpfr.org/mpfr-current/mpfr-4.1.0.tar.gz tar xvf mpfr-4.0.1.tar.gz cd mpfr-4.0.1 ./configure –prefix=/usr/local/mpfr –with-gmp=/usr/local/gmp make && make install
安装mpc包:
wget ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz tar xvf mpc-1.0.3.tar.gz cd mpc-1.0.3 ./configure –prefix=/usr/local/mpc –with-gmp=/usr/local/gmp -with-mpfr=/usr/local/mpfr make && make install
将库文件加入如下文件:
vi /etc/ld.so.conf 增加以下三行 /usr/local/gmp/lib /usr/local/mpfr/lib /usr/local/mpc/lib # 加完后使用如下命令更新 ldconfig -v
源码安装gcc包:
wget ftp://ftp.gnu.org/gnu/gcc/gcc-6.4.0/gcc-6.4.0.tar.gz tar xvf gcc-6.4.0.tar.gz ./configure –enable-checking=release –enable-languages=c,c++ –disable-multilib –with-gmp=/usr/local/gmp –with-mpfr=/usr/local/mpfr –with-mpc=/usr/local/mpc make -j2 make install
查看GCC
cd /usr/local/ wget http://ftp.gnu.org/gnu/glibc/glibc-2.29.tar.gz tar -zxvf glibc-2.29.tar.gz
编译出现错误
设置环境变量
继续安装
mkdir build cd build/ ../configure --prefix=/usr make -j2 make install
验证
本人安装过程中,主要参考了如下链接的文档:
https://blog.csdn.net/zhuyunfei/article/details/81290764
https://www.cnblogs.com/clairedandan/p/13811745.html