Configuration GCC找不到GMP、MPFR和MPC库

Configuration GCC找不到GMP、MPFR和MPC库,configuration,gcc,makefile,gmp,mpfr,Configuration,Gcc,Makefile,Gmp,Mpfr,我试图在MacOS10.5.7上交叉编译GCC。在安装GMP、MPFR和MPC后,我使用此命令配置GCC: ../gcc-4.5.0/configure --target=$i586-elf --prefix=/usr/local/cross \ --disable-nls \ --enable-languages=c,c++,fortran,java,objc,obj-c++,treelang,ada \ --without-headers --with-libicon

我试图在MacOS10.5.7上交叉编译GCC。在安装GMP、MPFR和MPC后,我使用此命令配置GCC:

../gcc-4.5.0/configure --target=$i586-elf --prefix=/usr/local/cross \
    --disable-nls \
    --enable-languages=c,c++,fortran,java,objc,obj-c++,treelang,ada \
    --without-headers --with-libiconv-prefix=/opt/local --with-gmp=/usr/local \
    --with-mpfr=/usr/local --with-mpc=/usr/local
我得到了这个错误:

checking for the correct version of gmp.h... buggy but acceptable
checking for the correct version of mpfr.h... yes
checking for the correct version of mpc.h... yes
checking for the correct version of the gmp/mpfr/mpc libraries... no
configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ 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
ftp://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.

为什么GCC可以找到GMP、MPFR和MPC的头文件,而不能找到库文件?

我怀疑问题可能是,当您试图构建64位编译器时,库文件是32位的,反之亦然

我最近能够在MacOS X 10.6.4上构建GCC 4.5.1,但我自己在
/usr/gnu64
中构建并安装了GMP、MPFR和MPC库(我为自己的利益而安装的东西使用的非标准位置)。我还使用了配置选项:

CC='gcc -m64'
强制64位生成。我在Linux上也有类似的问题(加上opt-functions.awk中的一个regex问题-用一个大括号前面的两个反斜杠很容易修复),并且发现自从我在MacOS X上构建之后,MPFR和MPC库有了更新:

  • GMP 5.0.1(代替4.2.4)
  • MPC 0.8.2(代替0.8.1)
  • MPFR 3.0.0(代替2.4.2)


自从我写了这篇文章之后,我的方法有所改变。我现在所做的记录在中。基本上,我得到了GMP、MPC、MPFR的当前版本,并将它们的源代码放到GCC源目录中,让GCC自己编译库。这使得GCC需要定位库

我在OX10.6.6上编译gcc-4.6.0时遇到了同样的问题。我正在使用gmp-4.3.2;使用gmp-5.0.1,配置脚本似乎正确猜测“CC=gcc-std=gnu99 CFLAGS=-O2-pedantic-m64-mtune=core2-march=core2”,并将其传递给mpfr(3.0.1)和mpc(0.9),因此任何使用这些或更新版本的人都不应该出现此错误。

您应该使用

--with-gmp=/usr/local/include \
    --with-mpfr=/usr/local/include --with-mpc=/usr/local/include
而不是

--with-gmp=/usr/local \
    --with-mpfr=/usr/local --with-mpc=/usr/local

安装了mac端口mpfr、libmpc和gmp后,我能够在配置脚本中解决这个问题:

--with-mpc=/opt/local/var/macports/software/libmpc/0.8.2_0/opt/local
--with-gmp=/opt/local/var/macports/software/gmp/5.0.1_0/opt/local
--with-mpfr=/opt/local/var/macports/software/mpfr/3.0.0-p8_0/opt/local 

这是为了编译一个ti msp430工具链。

我刚刚解决了一个类似的问题。由于我的CPU是x86_64,但我的操作系统是32位的,所以当我安装GMP(5.0.2)时,它会尝试以64位进行配置。所以我用ABI=32/配置这样的配置重新编译了我的GMP。。。然后这个GCC问题消失了。

我建议通过从他们的网站下载来安装gmp、mpfr和mpc。然后运行
/configure
(在下载文件的文件夹中)和
sudo make install

GCC应该在MacOSX(MountainLion)上编译

注意,mpc取决于mpfr和gmp


我用它在Mac OSX上编译Piven内核。

在Ubuntu 16.04 64位中也有类似的问题。通过使用mpc-1.0.1.tar.gz、mpfr-3.1.6.tar.xz和gmp-6.1.2.tar.xz解决了同样的问题。我尝试从头开始构建Linux时遇到了相同的问题:两个地方之一:
CC=“gcc-m64”。/gcc-4.5.1/configure…
或者您可以将其指定为参数:
。/gcc-4.5.1/configure CC=“gcc-m64”。
。两者都起作用;我通常使用它作为环境变量(在命令之前)。如果使用seashell(tcsh等),请使用参数形式。这是不正确的。GCC的
/configure
脚本指出
--使用mpc=PATH
相当于--使用mpc include=PATH/include plus--使用mpc lib=PATH/lib,并且与
--使用gmp
--使用mpfr
的措辞相同