C++ 如何在CentOS 6 x64上构建gcc 4.7.2

C++ 如何在CentOS 6 x64上构建gcc 4.7.2,c++,linux,gcc,centos,centos6,C++,Linux,Gcc,Centos,Centos6,我正在尝试在CentOS上构建最新的(在编写本文时)GCC版本。 我下载并建立了GMP、MPFR和MPC。这些库位于/usr/local下(即usr/local/lib表示库,而/usr/local/include表示包含)。现在,我正尝试使用以下命令将GCC配置为生成: ./configure --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local 我收到以下错误消息: checking for the corre

我正在尝试在CentOS上构建最新的(在编写本文时)GCC版本。 我下载并建立了GMP、MPFR和MPC。这些库位于/usr/local下(即usr/local/lib表示库,而/usr/local/include表示包含)。现在,我正尝试使用以下命令将GCC配置为生成:

./configure --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local
我收到以下错误消息:

checking for the correct version of gmp.h... yes
checking for the correct version of mpfr.h... yes
checking for the correct version of mpc.h... yes
checking for the correct version of the gmp/mpfr/mpc libraries... 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.
原因可能是什么?库是生成的,位置正确,头文件可以识别,但库本身不能识别。我也试过:

./configure --with-gmp-lib=/usr/local/lib \
--with-mpfr-lib=/usr/local/lib --with-mpc-lib=/usr/local/lib

但是结果是一样的。

谢谢,我调查了自己;问题是在CentOS 6中预装了GMP/MPFR/MPC的旧版本,它们与我新构建的库相冲突。

有人为此编写了一个脚本。它解决了库对这些库的依赖性以及它们之间的依赖性问题。

对我来说,它只做了一些小的修改,但最终的gcc有一个古怪的链接路径(它生成的二进制文件仍在寻找libstdc++。因此在包含旧库的常规系统路径中。我有一个问题:


强烈建议使用GCC SRC(http://www.gnu.org/software/gsrc/)

首先需要安装Python和bzr

然后在配置之后(gsrc网页中的步骤),只需在gsrc目录中执行这些操作

make-C gnu/gcc

make-cgnu/gcc安装

我希望您在配置时启用插件