web-dev-qa-db-ja.com

GCCの構築には、GMP 4.2 +、MPFR 2.3.1+、およびMPC 0.8.0+が必要です

http://www.netgull.com/gcc/releases/gcc-4.5.0/ からGCC 4.5をダウンロードしましたが、セットアップ/ビルドしようとすると次のエラーが発生します。

Linux:>~/shared_scripts/bin/gcc/gcc-4.5.0 1040> /x/home/prakash_satya/shared_scripts/bin/gcc/gcc-4.5.0/configure CC="gcc -m64" --prefix=/x/home/prakash_satya/shared_scripts/bin/gcc/gcc-4.5.0 --with-gmp-lib=/usr/lib64 --with-mpfr-lib=/usr/lib64 --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++
checking build system type... x86_64-unknown-linux-gnu
checking Host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for gawk... gawk
checking for gcc... gcc -m64
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -m64 accepts -g... yes
checking for gcc -m64 option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for objdir... .libs
checking for the correct version of gmp.h... 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.
Linux:>~/shared_scripts/bin/gcc/gcc-4.5.0 1041>

次のライブラリは、それぞれのディレクトリに存在します

/usr/lib/libgmp.a
/usr/lib64/libgmp.a

/usr/lib/libmpfr.a
/usr/lib64/libmpfr.a

ボックス内のどこにもlibmpc.aライブラリがインストールされていません。

エラーに基づいてどのように私は知ることができます:

a)libgmp.aおよびlibmpfr.aの現在のバージョンは何がインストールされているか。

b)バージョンが正しくない場合、現在のバージョンに影響を与えずに独自のバージョンを展開するにはどうすればよいですか?

54
Programmer

これらのライブラリがインストールされているディレクトリ(/usr/gnu64/lib)には、読み取り可能なテキストを含むlibgmp.laファイル(およびlibmpc.laおよびlibmpfr.laファイル)もあります。 SOバージョン情報はそこにありますが、それは「製品バージョン」とまったく同じではありません。代わりにリンクの互換性について伝えます。

私が持っているバージョンを調べようとしていましたが、私が思いついた奇妙な解決策は、-vオプションでビルドしたGCC(4.6.1)を実行することでした。一部では、それは言った:

GNU C (GCC) version 4.6.1 (x86_64-Apple-darwin11.1.0)
    compiled by GNU C version 4.6.1, GMP version 5.0.1, MPFR version 3.0.0, MPC version 0.8.2
warning: GMP header version 5.0.1 differs from library version 5.0.2.
warning: MPFR header version 3.0.0 differs from library version 3.1.0.
warning: MPC header version 0.8.2 differs from library version 0.9.

したがって、GMP 5.0.2がインストールされているようですが(ただし、GCCは5.0.1で構築されています)、MPFR 3.1.0(しかしGCCは3.0.0で構築されています)およびMPC 0.9(しかし、GCCは0.8.2で構築されています) )。 GCC 4.6.2をコンパイルしてインストールしようとしましたが、おそらく新しいバージョンが必要だったため、不一致が生じます。 (私は成功しませんでしたが、それは別の話です。)

カスタムビルドライブラリを/usr/gnu64/libにインストールし、構成オプション--with-mpfr=/usr/gnu64/lib--with-gmp=/usr/gnu64/lib--with-mpc=/usr/gnu/64/libを使用して、GCCにそれらの場所を指定します。これらのパスはGCCに組み込まれており、そこから機能します。

8

Gccディレクトリ内で、次のコマンドを実行します。

./contrib/download_prerequisites

そのスクリプトの後、GMP、MPFR、およびMPCを使用する準備が整います。を続行 ./configure

111
Joseph Hansen

GCC 4.8.1をインストール/コンパイルしようとすると、同じ問題が発生しました。ここに私が解決した方法があります:

Debianでは、次の2つのコマンドを実行するだけです。

apt-get install libmpc-dev
./configure
56
Damico

GCC 4.9ブランチのコンパイルでも同じ問題が発生しました。

Red HatおよびFedoraベースのシステムの場合、次のコマンドを実行します。

Sudo yum install gmp gmp-devel mpfr mpfr-devel libmpc libmpc-devel

これにより、整数、浮動小数点、および複素数用のGNU複数精度(MP)ライブラリがインストールされます。

17
etherice