我是Red Hat Enterprise linux的新手。 我在Red Hat Enterprise Linux 6.5上编译gcc 4.8.2时遇到了问题 我失败了;从GNU webite中获取源代码。 我按照这个链接的步骤 http://gcc.gnu.org/wiki/InstallingGCC 触发的命令是:
tar xzf gcc-4.6.2.tar.gz
cd gcc-4.6.2
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-4.8.2/configure
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-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 libatomic support... yes
checking for libitm support... yes
checking for libsanitizer support... yes
checking for gcc... gcc
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 accepts -g... yes
checking for gcc 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 whether g++ accepts -static-libstdc++ -static-libgcc... no
checking for gnatbind... gnatbind
checking for gnatmake... gnatmake
checking whether compiler driver understands Ada... yes
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.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.
我在谷歌调查后发现以下与此相关的问题 http://gcc.gnu.org/ml/gcc-help/2012-02/msg00142.html 但它再次将我重定向到我之前发现并遵循的上述链接。
我需要有关如何处理此问题的指导。 欢迎提出建议。
答案 0 :(得分:6)
在RHEL 6上使用gcc 4.8.2的官方方法是安装Red Hat Developer Toolset(yum install devtoolset-2),为了拥有它,你需要拥有以下订阅之一:
您可以通过运行以下方式检查是否有任何订阅:
subscription-manager list --available
和
subscription-manager list --consumed
。
如果您没有这些订阅,那么您将无法成功安装devtoolset-2"。然而,幸运的是,cern提供了一个"后门"对于他们的SLC6,也可以在RHEL 6中使用。通过root运行三行以下,你应该可以拥有它:
wget -O /etc/yum.repos.d/slc6-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo
wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-cern http://ftp.scientificlinux.org/linux/scientific/5x/x86_64/RPM-GPG-KEYs/RPM-GPG-KEY-cern
yum install devtoolset-2
一旦完成,您应该在/ opt / rh / devtoolset-2 / root /中使用新的开发包。
答案 1 :(得分:1)
由于某些原因,没有下载mpc / mpfr / gmp软件包。只需查看您的gcc源目录,它应该已经为这些包创建了符号链接:
gcc/4.9.1/install$ ls -ad gmp mpc mpfr
gmp mpc mpfr
如果这些内容无法显示,只需从gcc网站下载:ftp://gcc.gnu.org/pub/gcc/infrastructure/
然后解压缩并对其进行符号链接/重命名,以便您拥有上述目录。然后当你./configure和make时,gcc的makefile会自动为你构建它们。