建立GCC需要GMP 4.2 +,MP​​FR 2.3.1+和MPC 0.8.0+

Pro*_*mer 61 gcc mpfr gmp mpc

我从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>
Run Code Online (Sandbox Code Playgroud)

以下库存在各自的目录中

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

/usr/lib/libmpfr.a
/usr/lib64/libmpfr.a
Run Code Online (Sandbox Code Playgroud)

我没有在框中的任何地方安装libmpc.a库.

根据错误我怎么知道:

a)安装了当前版本的libgmp.a和libmpfr.a.

b)如果它们的版本不正确,我如何在不打扰当前版本的情况下部署我自己的版本?

Jos*_*sen 128

在gcc目录中,执行以下命令:

./contrib/download_prerequisites
Run Code Online (Sandbox Code Playgroud)

在该脚本之后,GMP,MPFR和MPC将可以使用.继续./configure.

  • 你是我的英雄。 (4认同)
  • 感谢那.我被困在一台没有"sudo"的机器上,这解决了我的困境 (3认同)
  • 试图在Windows上的ubuntu上的bash上安装gcc 6.2,此命令对我有用。谢谢! (2认同)
  • 我整天都在寻找。非常感谢! (2认同)
  • 死了,这应该是正确的答案。超级明星。 (2认同)

小智 57

我在尝试安装/编译GCC 4.8.1时遇到了同样的问题.以下是我的解决方法:

在Debian中,只需运行以下两个命令:

apt-get install libmpc-dev
./configure
Run Code Online (Sandbox Code Playgroud)

  • 在Amazon Linux上,它是`sudo yum install libmpc-devel` (2认同)

eth*_*ice 18

我在编译GCC 4.9分支时遇到了同样的问题.

对于基于Red HatFedora的系统,请运行以下命令:

sudo yum install gmp gmp-devel mpfr mpfr-devel libmpc libmpc-devel

这将为整数,浮点和复数安装GNU多精度(MP)库.


Jon*_*ler 10

在我安装了这些库的目录(/usr/gnu64/lib)中,我还有一个包含可读文本的libgmp.la文件(libmpc.lalibmpfr.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.
Run Code Online (Sandbox Code Playgroud)

因此,似乎我安装了GMP 5.0.2(但我用5.0.1构建了GCC),MPFR 3.1.0(但我用3.0.0构建了GCC)和MPC 0.9(但是我用0.8.2构建了GCC) ).不匹配的原因在于我试图编译和安装GCC 4.6.2并且它可能需要更新的版本.(我没有成功,但这是一个不同的故事.)

我安装在我的定制库/usr/gnu64/lib,然后告诉GCC这就是与配置选项找到它们--with-mpfr=/usr/gnu64/lib,--with-gmp=/usr/gnu64/lib,--with-mpc=/usr/gnu/64/lib.这些路径硬连接到GCC,它可以在那里工作.

  • 自写这篇文章以来,我已经开始让GCC与编译器一起构建GMP,MPFR和MPC的版本.我现在获取当前版本库的源代码,并将其解压缩到GCC源代码的顶级目录:gmp-6.0.0,mpfr-3.1.2等.然后我为每个库创建一个符号链接:`ln -s gmp-6.0.0 gmp; ln -s mpfr-3.1.2 mpfr; ln -s mpc-1.0.2 mpc`.然后我运行GCC配置和构建,GCC也构建这些库. (2认同)