Error:Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+

参考链接:
https://blog.csdn.net/enson16855/article/details/52205044


编译高版本gcc,执行下面配置命令时,

../configure --prefix=/usr/local/gcc-10.2.0/ --enable-checking=release --enable-languages=c,c++ --disable-multilib

报错如下:

adams@adams-pc:~/tmp/gcc/gcc-10.2.0/build$ ../configure --prefix=/usr/local/gcc-10.2.0/ --enable-checking=release --enable-languages=c,c++ --disable-multilib
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for gawk... gawk
checking for libatomic support... yes
checking for libitm support... yes
checking for libsanitizer support... yes
checking for libvtv support... yes
checking for libhsail-rt support... yes
checking for libphobos support... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ accepts -static-libstdc++ -static-libgcc... yes
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for objdir... .libs
checking for the correct version of gmp.h... yes
checking for the correct version of mpfr.h... yes
checking for the correct version of mpc.h... no
configure: error: Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations.  Source code for these libraries can be found at
their respective hosting sites as well as at
https://gcc.gnu.org/pub/gcc/infrastructure/.  See also
http://gcc.gnu.org/install/prerequisites.html for additional info.  If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files.  They may be located in separate packages.
adams@adams-pc:~/tmp/gcc/gcc-10.2.0/build$ 

根据报错信息可以知道,是GMP,MPFR和MPC版本太低导致的上述问题。

所以需要编译出高版本,然后在编译gcc时指定路径,使其在编译时可以找到高版本的库以及头文件。


GMP编译

下载地址:
ftp://ftp.gnu.org/gnu/gmp/

我们选择gmp-5.0.1.tar.bz2版本进行下载。

wget ftp://ftp.gnu.org/gnu/gmp/gmp-5.0.1.tar.bz2
tar -vxf gmp-5.0.1.tar.bz2
cd gmp-5.0.1/
./configure --prefix=/usr/local/gmp-5.0.1
make
sudo make install

MPFR编译

下载地址:
https://ftp.gnu.org/gnu/mpfr/

我们选择mpfr-3.1.5.tar.xz版本进行下载。

wget https://ftp.gnu.org/gnu/mpfr/mpfr-3.1.5.tar.xz
tar -vxf mpfr-3.1.5.tar.gz
cd mpfr-3.1.5/
./configure --prefix=/usr/local/mpfr-3.1.5 --with-gmp=/usr/local/gmp-5.0.1
make
sudo make install

MPC编译

下载地址:
http://www.multiprecision.org/mpc/download.html

我们选择mpc-0.9.tar.gz版本进行下载。

wget http://www.multiprecision.org/downloads/mpc-0.9.tar.gz
tar -vxf mpc-0.9.tar.gz
cd mpc-0.9/
./configure --prefix=/usr/local/mpc-0.9 --with-gmp=/usr/local/gmp-5.0.1 --with-mpfr=/usr/local/mpfr-3.1.5
make
sudo make install

GCC 配置
../configure --prefix=/usr/local/gcc-10.2.0/ --enable-checking=release --enable-languages=c,c++ --disable-multilib --with-gmp=/usr/local/gmp-5.0.1 --with-mpfr=/usr/local/mpfr-3.1.5 --with-mpc=/usr/local/mpc-0.9

这次就可以配置成功了!


CSDN下载:

gmp-5.0.1.tar.bz2

mpc-0.9.tar.gz

mpfr-3.1.5.tar.xz

没有积分的话,可以给我留言。


评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值