2010-08-18 152 views
7

我想在Mac OS 10.5.7上交叉编译GCC。我用这个命令安装GMP,MPFR和MPC后配置GCC:GCC不能找到GMP,MPFR和MPC库

../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而不是头图书馆?

+0

我有同样的问题试图从头开始构建Linux:D: – Chiggins 2010-08-18 02:25:17

回答

6

我怀疑问题可能在于当您尝试构建64位编译器时,库是32位的,反之亦然。

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

CC='gcc -m64' 

强制执行64位版本。我在Linux上遇到了类似的问题(加上opt-functions.awk中的正则表达式存在问题 - 在一个开放的大括号前用两个反斜杠很容易修复),并发现MPFR和MPC库有更新,因为我建立了的MacOS X:

  • GMP 5.0.1(而不是4.2.4)
  • MPC 0.8.2(而不是0.8.1)
  • MPFR 3.0.0(而不是2.4.2)

由于我写了这个,我改变了我的方法somewha吨。我现在所做的是在Install GNU GCC on Mac中记录。基本上,我得到当前版本的GMP,MPC,MPFR,并将它们的源代码放入GCC源代码目录,并让GCC自行编译这些库。这使得GCC处理库的定位。

+0

I使用'CC = gcc -m64'',它的工作原理是 – None 2010-08-18 19:14:45

+2

你把CC = gcc -m64'放在哪里? 我是Linux新手...... – 2011-01-26 14:47:59

+0

两个地方之一:'CC =“gcc -m64”../gcc-4.5.1/configure ...'或者你可以指定它为一个参数: '../gcc-4.5.1/configure CC =“gcc -m64”...'。两者都有效;我通常将它用作环境变量(在命令之前)。如果您使用海贝壳(tcsh等),请使用参数表单。 – 2011-01-26 15:27:58

2

我试图在OX 10.6.6上编译gcc-4.6.0时出现同样的问题。我使用的是gmp-4.3.2;使用相反的gmp-5.0.1,configure脚本似乎正确地猜测出“CC = gcc -std = gnu99 CFLAGS = -O2 -pedantic -m64 -mtune = core2 -march = core2”,并将其传递给mpfr(3.0。 1)和mpc(0.9),所以任何使用这些或更新版本的人都不应该得到这个错误。

5

您应该使用

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 
+1

这是不正确的。 GCC的'./configure'脚本指出'--with-mpc = PATH'是'--withwith-mpc-include = PATH/include加--with-mpc-lib = PATH/lib', '--with-gmp'和'--with-mpfr'的确切用词 – uxp 2017-06-04 16:58:00

0

与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工具链。

0

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

1

我会建议安装gmp,mpfr和mpc从他们的网站下载并运行。/ congifure(其中下载文件的文件夹中),然后须藤使安装

GCC,那么应该编译在Mac OS X(美洲狮)

注意,MPC取决于MPFR和GMP

我用这在mac os上编译pinion内核x

0

在Ubuntu 16.04 64位有类似的问题。通过使用mpc-1.0.1.tar.gz解决,mpfr-3.1.6.tar.xz和gmp-6.1.2.tar.xz