0

I am new to Red Hat Enterprise linux. I am facing issues while compiling gcc 4.8.2 on Red Hat Enterprise Linux 6.5 I down;oaded the source code from GNU webite. I followed steps from this link http://gcc.gnu.org/wiki/InstallingGCC Commands fired are:

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.

I investigated on Google then i find following question related to this http://gcc.gnu.org/ml/gcc-help/2012-02/msg00142.html but it again redirected me to above link which i found and followed earlier.

I need guidance about how to proceed with this issue. Suggestions are welcome.

Dhiraj
  • 257
  • 1
  • 5
  • 13
  • As mentioned,you have to have the mentioned libraries as shown in the error log---`gmp`,`mpfr` and `mpc`! – Am_I_Helpful Aug 21 '14 at 18:12
  • i think using `yum info` you can know if you have that utilities installed or not. – DGomez Aug 21 '14 at 18:14
  • 2
    Consider just installing the Redhat Developer Toolset, which is an add-on that packages more recent versions of some important development software, including GCC. The commercial RedHat version is here: https://access.redhat.com/documentation/en-US/Red_Hat_Developer_Toolset/ The free identical CentOS version (works on RHEL) is here: http://linux.web.cern.ch/linux/devtoolset/ – Peter Aug 21 '14 at 18:15
  • Are you building GCC for fun/learning or because you need a newer version? – pqnet Aug 21 '14 at 18:17
  • I see both 4.6.2 and 4.8.2 in your post, did you consistently type the same version? – Marc Glisse Aug 21 '14 at 20:44
  • @Marc: Yes that was typo it is 4.8.2 – Dhiraj Aug 27 '14 at 17:28

2 Answers2

9

The official way to have gcc 4.8.2 on RHEL 6 is via installing Red Hat Developer Toolset (yum install devtoolset-2), and in order to have it you need to have one of the below subscriptions:

  • 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 day Self-Supported Red Hat Enterprise Linux Developer Workstation Evaluation
  • 60 day Supported Red Hat Enterprise Linux Developer Workstation Evaluation
  • 90 day Supported Red Hat Enterprise Linux Developer Workstation Evaluation
  • 1-year Unsupported Partner Evaluation Red Hat Enterprise Linux
  • 1-year Unsupported Red Hat Advanced Partner Subscription

You can check whether you have any of these subscriptions by running:

subscription-manager list --available

and

subscription-manager list --consumed.

If you don't have any of these subscriptions, you won't succeed in "yum install devtoolset-2". However, luckily cern provide a "back door" for their SLC6 which can also be used in RHEL 6. Run below three lines via root, and you should be able to have it:

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

Once it's done completely, you should have the new development package in /opt/rh/devtoolset-2/root/.

Sharjeel Aziz
  • 8,495
  • 5
  • 38
  • 37
suny6
  • 91
  • 1
  • 4
  • 2
    Please use http://ftp.scientificlinux.org/linux/scientific/obsolete/5x/x86_64/RPM-GPG-KEYs/RPM-GPG-KEY-cern for the Key URL – ggonzal May 08 '18 at 16:40
1

For some reason the mpc/mpfr/gmp packages aren't being downloaded. Just look in your gcc source directory, it should have created symlinks to those packages:

gcc/4.9.1/install$ ls -ad gmp mpc mpfr
gmp  mpc  mpfr

If those don't show up then simply download them from the gcc site: ftp://gcc.gnu.org/pub/gcc/infrastructure/

Then untar and symlink/rename them so you have the directories like above. Then when you ./configure and make, gcc's makefile will automatically build them for you.

eresonance
  • 1,351
  • 11
  • 12