我是Red Hat Enterprise linux的新手。我在红帽企业Linux 6.5上编译gcc 4.8.2时面临问题我从GNU网站下载了源代码。我按照这个链接的步骤进行操作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但是它又把我重定向到上面的链接,我发现并遵循了。
我需要指导如何处理这个问题。
在RHEL 6上安装gcc 4.8.2的官方方式是通过安装Red Hat Developer Toolset (yum install devtoolset-2),为了拥有它,你需要拥有以下订阅之一:
- Red Hat Enterprise Linux Developer Support, Professional
- Red Hat Enterprise Linux Developer Support, Enterprise
- Red Hat Enterprise Linux Developer Suite
- Red Hat Enterprise Linux Developer Workstation, Professional
- Red Hat Enterprise Linux Developer Workstation, Enterprise
- 30天自助红帽企业Linux开发人员工作站评估
- 60天支持的红帽企业Linux开发人员工作站评估
- 90天支持的红帽企业Linux开发人员工作站评估
- 1年不支持的合作伙伴评估红帽企业Linux
- 1年不支持的红帽高级合作伙伴订阅
您可以运行命令
检查您是否有这些订阅: subscription-manager list --available
和
subscription-manager list --consumed
.
如果您没有这些订阅,您将无法成功执行"yum install devtoolset-2"。然而,幸运的是,cern为他们的SLC6提供了一个"后门",也可以在RHEL 6中使用。在根目录下运行下面三行代码,你应该能看到它:
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/中拥有新的开发包。
由于某些原因,没有下载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/
然后untar和symlink/重命名它们,这样你就有了上面的目录。然后当你使用。/configure和make时,gcc的makefile会自动为你构建它们。