【问题标题】:GCC upgrade - GMP version causing issuesGCC 升级 - 导致问题的 GMP 版本
【发布时间】:2016-09-06 21:46:25
【问题描述】:

我正在尝试将我拥有的特定 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 位置,所以它们应该已经在搜索路径上。

【问题讨论】:

  • 如果你用实际信息替换“a machine”、“a version”等会更简单...不,libsmurf.XYZ 中的数字不应该与包有任何关系版本。您应该检查 config.log。如果由于某种原因编译失败或版本错误,则错误消息是相同的。

标签: c++ gcc dependencies gmp


【解决方案1】:

请阅读Installing GCC:

不推荐的困难方法是下载 GMP、MPFR 和 MPC 的源代码,然后在非标准位置配置和安装它们,然后使用 --with-gmp=/some/ 配置 GCC silly/path/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 即可为自己节省大量时间和痛苦。

【讨论】:

  • 我无法在这台机器上运行 download_prerequisites,因为它没有联网。我查看了安装 GCC 页面,上面写着For RPM-based systems, including Fedora and SUSE, you should install gmp-devel, mpfr-devel and libmpc-devel (or mpc-devel on SUSE) packages. The packages will install the libraries and headers in standard system directories so they can be found automatically when building GCC,我认为这适用于我的情况,因此我不需要“困难的方式”。只是它显然没有正确选择 gmp 版本..
【解决方案2】:

事实证明,“构建 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 没有削减它。

【讨论】:

    猜你喜欢
    • 2013-06-29
    • 1970-01-01
    • 2020-01-03
    • 2021-03-12
    • 2014-05-21
    • 1970-01-01
    • 2019-02-16
    • 2021-10-12
    • 1970-01-01
    相关资源
    最近更新 更多