GCC升级 - 导致问题的GMP版本

时间:2016-05-11 13:01:59

标签: c++ gcc dependencies gmp

我试图在我拥有的特定Linux机器上更新GCC,以及没有可用软件包的版本。

我运行配置脚本,它抱怨GMP的版本:

# ../gcc/configure
checking build system type... i686-pc-linux-gnu
[snip]
checking for the correct version of gmp.h... no
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ 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.

然而,当我检查gmp.h时,它显示:

/* Major version number is the value of __GNU_MP__ too, above and in mp.h. */
#define __GNU_MP_VERSION 4
#define __GNU_MP_VERSION_MINOR 2
#define __GNU_MP_VERSION_PATCHLEVEL 1

和RPM报告以下内容:

# rpm -q --qf "%{VERSION}\n" gmp
4.2.1
# rpm -q --qf "%{VERSION}\n" gmp-devel
4.2.1

所以库和标题似乎对我来说都是正确的版本(令人困惑的是,libgmp的.so文件的编号似乎与版本号完全无关......显示为

libgmp.so -> libgmp.so.3.4.1

有谁知道为什么会失败?这是本机上安装的唯一两个gmp软件包,它们位于标准的/ usr / include和/ usr / lib位置,因此它们应该已经在搜索路径上。

2 个答案:

答案 0 :(得分:0)

请阅读Installing GCC

  

不推荐的困难方法是下载GMP,MPFR和MPC的源,然后在非标准位置配置和安装每个源,然后使用--with-gmp = / some /配置GCC傻/路径/ gmp --with-mpfr = / some / silly / path / mpfr --with-mpc = / some / silly / path / mpc,然后强制设置LD_LIBRARY_PATH = / some / silly / path / gmp: / some / silly / path / mpfr:/ some / silly / path / mpc / lib永远在你的环境中。对于那些不了解动态链接器如何在运行时找到库的人来说,这是愚蠢的并且会导致严重的问题。不要这样做。如果在使用任何--with-gmp或--with-mpfr或--with-mpc选项时构建GCC失败,那么您可能不应该使用它们。

只需运行./contrib/download_prerequisites并节省大量时间和痛苦。

答案 1 :(得分:0)

事实证明"建立GCC需要GMP 4.2 +"不够详细。深入配置,它实际上正在检查:

  #if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,2,3)
  choke me
  #endif

即。 GMP 4.2 .3 或更高,所以我的4.2.1并没有削减它。

相关问题