首页 文章

GCC无法找到GMP,MPFR和MPC库

提问于
浏览
7

我试图在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的头部而不是库?

7 回答

  • 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中的正则表达式问题 - 在开放式大括号前用两个反斜杠很容易修复)并发现自从我 Build 以来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)


    自从我写这篇文章以来,我已经改变了我的方法论 . 我现在所做的事情记录在Install GNU GCC on Mac中 . 基本上,我获得当前版本的GMP,MPC,MPFR并将其源代码放入GCC源目录,并让GCC自行编译库 . 这使得GCC处理定位库 .

  • 0

    你应该用

    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
    
  • 0

    我在尝试在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)和mpc(0.9),所以使用这些或更新版本的人不应该得到这个错误 .

  • 1

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

    GCC应该在Mac OSX(山狮)上编译 .

    请注意,mpc取决于mpfr和gmp .

    我用这个来编译Mac OSX上的小齿轮内核 .

  • 5

    安装了mac ports mpfr,libmpc和gmp后,我能够在configure脚本上解决这个问题:

    --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位配置 . 所以我用ABI = 32 . / configure等配置重新编译了我的GMP ......然后这个GCC问题就消失了 .

  • 2

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

相关问题