1.下载GCC安装包,下载地址如下,选择需要的安装版本:

https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/

2.解压配置

  进入解压目录执行:./configure

可能会遇到下面的问题:

configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
Try the –with-gmp, –with-mpfr and/or –with-mpc options to specify

需要安装 :GMP >=4.2+, MPFR >=2.4.0+ and MPC >=0.8.0+

2.1 GMP安装教程:安装gmp-6.1.2库 – 云+社区 – 腾讯云 (tencent.com)

GMP下载:https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz

如果GMP ./configure 配置失败,报错如下:

                   configure: error: gmp.h cannot be found

还需要安装:yum install gmp-devel

下载地址如下:

http://mirror.centos.org/centos/7/os/x86_64/Packages/gmp-devel-6.0.0-15.el7.x86_64.rpm

2.2 MPFR下载安装:

wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
bunzip2 mpfr-2.4.2.tar.bz2
tar xvf mpfr-2.4.2.tar
cd mpfr-2.4.2
./configure –disable-shared –enable-static –prefix=/tmp/gcc –with-gmp=/tmp/gcc
make && make check && make install

2.3 MPC下载地址:Index of /gnu/mpcicon-default.png?t=M276https://ftp.gnu.org/gnu/mpc/

Download — multiprecision.org

3. 配置并安装gcc

gcc安装参考教程:(56条消息) Centos下gcc的安装、gcc的更新、gcc安装过程中报错:make[1]: *** [stage1-bubble] 错误 2_点亮~黑夜的博客-CSDN博客_gcc make报错


版权声明:本文为ab0902cd原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/ab0902cd/article/details/123850835