GCC 找不到 GMP、MPFR 和 MPC 库
我正在尝试在 Mac OS 10.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 的标头,但找不到库?
I am trying to cross-compile GCC on Mac OS 10.5.7. I used this command to configure GCC after installing GMP, MPFR, and 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
I got this error:
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.
Why could GCC find the headers for GMP, MPFR, and MPC but not the libraries?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
我怀疑问题可能在于,当您尝试构建 64 位编译器时,这些库适用于 32 位,反之亦然。
我最近能够在 MacOS X 10.6.4 上构建 GCC 4.5.1,但我自己构建并安装了 GMP、MPFR 和 MPC 库 - 在
/usr/gnu64
(一个非标准位置,我用于为自己的利益而安装的东西)。我还使用了配置选项:强制进行 64 位构建。我在 Linux 上遇到了类似的问题(加上 opt-functions.awk 中的正则表达式的问题 - 使用左大括号前面的两个反斜杠可以轻松修复),并发现自从我构建以来 MPFR 和 MPC 库有了更新MacOS X:
自从我写这篇文章以来,我稍微改变了我的方法。我现在所做的记录在在 Mac 上安装 GNU GCC 中。基本上,我获取了 GMP、MPC、MPFR 的当前版本,并将它们的源代码放入 GCC 源目录中,然后让 GCC 自己编译库。这使得 GCC 负责定位库。
I suspect that the problem may be that the libraries are for 32-bit when you are attempting to build a 64-bit compiler, or vice versa.
I was able to build GCC 4.5.1 on MacOS X 10.6.4 recently, but I built and installed the GMP, MPFR and MPC libraries myself - in
/usr/gnu64
(a non-standard location that I use for stuff that I install for my own benefit). I also used the configuration option:to force a 64-bit build. I had similar problems on Linux (plus a problem with a regex in opt-functions.awk - easily fixed with two back-slashes in front of an open brace) and found that there were updates to the MPFR and MPC libraries since I built on MacOS X:
Since I wrote this, I've changed my methodology somewhat. What I now do is documented in Install GNU GCC on Mac. Basically, I get the current versions of GMP, MPC, MPFR and put their source code into the GCC source directory, and let GCC compile the libraries for itself. This makes GCC deal with locating the libraries.
你应该使用
而不是
You should use
instead of
我尝试在 OX 10.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)。 1) 和 mpc (0.9) ,因此使用这些或更新版本的任何人都不会收到此错误。
I had the same problem trying to compile gcc-4.6.0 on OX 10.6.6. I was using gmp-4.3.2 ; using instead gmp-5.0.1, the configure script appears to correctly guess "CC=gcc -std=gnu99 CFLAGS=-O2 -pedantic -m64 -mtune=core2 -march=core2", and passes that on to mpfr (3.0.1) and mpc (0.9) , so anyone using these or more recent versions shouldn't get this error.
我建议通过从其网站下载 gmp、mpfr 和 mpc 来安装它们。然后运行
./configure
(在下载文件的文件夹中)和sudo make install
。GCC 应该可以在 Mac OSX(山狮)上编译。
请注意,mpc 取决于 mpfr 和 gmp。
我用它在 Mac OSX 上编译 pinion 内核。
I would suggest installing gmp, mpfr and mpc by downloading them from their websites. Then run
./configure
(in the folder where the files downloaded) andsudo make install
.GCC should compile then on Mac OSX (mountain lion).
Note that mpc depends on mpfr and gmp.
I used this to compile pinion kernel on Mac OSX.
安装了 mac ports mpfr、libmpc 和 gmp 后,我能够将其添加到配置脚本中:
这是编译 ti msp430 工具链。
With mac ports mpfr, libmpc and gmp installed, I was able to tack this on the configure script:
This was to compile a ti msp430 toolchain.
我刚刚解决了类似的问题。由于我的CPU是x86_64但我的操作系统是32位,当我安装GMP(5.0.2)时,它尝试配置为64位。所以我用 ABI=32 ./configure... 这样的配置重新编译了 GMP,然后这个 GCC 问题就消失了。
I just solved a similar problem. Since my CPU is x86_64 but my OS is 32bit, when I install GMP(5.0.2), it attempt to configure in 64bit. So I recompiled my GMP with configuration like ABI=32 ./configure... then this GCC problem disappeared.
在 Ubuntu 16.04 64 位中也有类似的问题。使用 mpc-1.0.1.tar.gz、mpfr-3.1.6.tar.xz 和 gmp-6.1.2.tar.xz 解决
Had similar problem in Ubuntu 16.04 64 bit. Solved by using mpc-1.0.1.tar.gz, mpfr-3.1.6.tar.xz and gmp-6.1.2.tar.xz