2010-08-18 197 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