GCC 升级 - GMP 版本导致问题
GCC upgrade - GMP version causing issues
我正在尝试将我拥有的特定 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 位置,因此它们应该已经在搜索路径上。
请阅读Installing GCC:
The difficult way, which is not recommended, is to download the sources for GMP, MPFR and MPC, then configure and install each of them in non-standard locations, then configure GCC with --with-gmp=/some/silly/path/gmp --with-mpfr=/some/silly/path/mpfr --with-mpc=/some/silly/path/mpc, then be forced to set LD_LIBRARY_PATH=/some/silly/path/gmp:/some/silly/path/mpfr:/some/silly/path/mpc/lib in your environment forever. This is silly and causes major problems for anyone who doesn't understand how dynamic linkers find libraries at runtime. Do not do this. If building GCC fails when using any of the --with-gmp or --with-mpfr or --with-mpc options then you probably shouldn't be using them.
只需 运行 ./contrib/download_prerequisites
即可节省大量时间和痛苦。
原来"Building GCC requires GMP 4.2+"不够详细。深入研究配置,它实际上是在检查:
#if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,2,3)
choke me
#endif
即GMP 4.2 .3 或更高版本,所以我的 4.2.1 没有削减它。
我正在尝试将我拥有的特定 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 位置,因此它们应该已经在搜索路径上。
请阅读Installing GCC:
The difficult way, which is not recommended, is to download the sources for GMP, MPFR and MPC, then configure and install each of them in non-standard locations, then configure GCC with --with-gmp=/some/silly/path/gmp --with-mpfr=/some/silly/path/mpfr --with-mpc=/some/silly/path/mpc, then be forced to set LD_LIBRARY_PATH=/some/silly/path/gmp:/some/silly/path/mpfr:/some/silly/path/mpc/lib in your environment forever. This is silly and causes major problems for anyone who doesn't understand how dynamic linkers find libraries at runtime. Do not do this. If building GCC fails when using any of the --with-gmp or --with-mpfr or --with-mpc options then you probably shouldn't be using them.
只需 运行 ./contrib/download_prerequisites
即可节省大量时间和痛苦。
原来"Building GCC requires GMP 4.2+"不够详细。深入研究配置,它实际上是在检查:
#if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,2,3)
choke me
#endif
即GMP 4.2 .3 或更高版本,所以我的 4.2.1 没有削减它。