Upgrade gcc to gcc-4.9 in RHEL 7

2

1

redhat 7 has gcc 4.8.5.

I want it to upgrade it to 4.9. For that I've used the below command

sudo yum install devtoolset-3-gcc.x86_64

And I got the below response

Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
Resolving Dependencies
--> Running transaction check
---> Package devtoolset-3-gcc.x86_64 0:4.9.1-10.el6 will be installed
--> Processing Dependency: devtoolset-3-binutils >= 2.22.52.0.1 for package: devtoolset-3-gcc-4.9.1-10.el6.x86_64
--> Processing Dependency: devtoolset-3-runtime for package: devtoolset-3-gcc-4.9.1-10.el6.x86_64
--> Processing Dependency: libmpfr.so.1()(64bit) for package: devtoolset-3-gcc-4.9.1-10.el6.x86_64
--> Processing Dependency: libgmp.so.3()(64bit) for package: devtoolset-3-gcc-4.9.1-10.el6.x86_64
--> Running transaction check
---> Package devtoolset-3-binutils.x86_64 0:2.24-18.el6 will be installed
---> Package devtoolset-3-gcc.x86_64 0:4.9.1-10.el6 will be installed
--> Processing Dependency: libmpfr.so.1()(64bit) for package: devtoolset-3-gcc-4.9.1-10.el6.x86_64
--> Processing Dependency: libgmp.so.3()(64bit) for package: devtoolset-3-gcc-4.9.1-10.el6.x86_64
---> Package devtoolset-3-runtime.noarch 0:3.0-15.el6 will be installed
--> Processing Dependency: scl-utils >= 20120927-11 for package: devtoolset-3-runtime-3.0-15.el6.noarch
--> Running transaction check
---> Package devtoolset-3-gcc.x86_64 0:4.9.1-10.el6 will be installed
--> Processing Dependency: libmpfr.so.1()(64bit) for package: devtoolset-3-gcc-4.9.1-10.el6.x86_64
--> Processing Dependency: libgmp.so.3()(64bit) for package: devtoolset-3-gcc-4.9.1-10.el6.x86_64
---> Package scl-utils.x86_64 0:20130529-17.el7_1 will be installed
--> Finished Dependency Resolution
Error: Package: devtoolset-3-gcc-4.9.1-10.el6.x86_64 (slc6-scl)
           Requires: libmpfr.so.1()(64bit)
Error: Package: devtoolset-3-gcc-4.9.1-10.el6.x86_64 (slc6-scl)
           Requires: libgmp.so.3()(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

I've verified that mpfr is installed

[ec2-user@ip-172-31-31-165 ~]$ sudo yum install mpfr-devel
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
Package mpfr-devel-3.1.1-4.el7.x86_64 already installed and latest version
Nothing to do
[ec2-user@ip-172-31-31-165 ~]$ sudo yum install mpfr
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
Package mpfr-3.1.1-4.el7.x86_64 already installed and latest version
Nothing to do

I've also verified that gmp is installed

[ec2-user@ip-172-31-31-165 ~]$ sudo yum install gmp
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
Package 1:gmp-6.0.0-12.el7_1.x86_64 already installed and latest version
Nothing to do
[ec2-user@ip-172-31-31-165 ~]$ sudo yum install gmp-devel
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
Package 1:gmp-devel-6.0.0-12.el7_1.x86_64 already installed and latest version
Nothing to do

But both of them are already exist in my system. Am I missing anything here? How can I install gcc version 4.9 in RHEL 7?

Samuel Alexander

Posted 2016-06-13T10:15:25.397

Reputation: 743

Answers

5


Not the year 2000 "redhat 7", but RHEL 7 : Redhat Enterprise Linux 7

Note : devtoolset-3 is not an update of gcc/g++, but just one of the extra compilers available for EL7 . I.e. you can have as many versions of gcc as you want, installed at the same time. Please make sure you have the system compiler installed : # yum install gcc-c++

Requires: libmpfr.so.1()(64bit)

Requires: libgmp.so.3()(64bit)


"devtoolset-3" is old (RHEL 6) : 1) Please install these packages (Built for EL7, 'Jan 2015') .... compat-libgmp-4.3.1-1.sl7.x86_64.rpm, compat-libmpfr-2.4.1-1.sl7.x86_64.rpm

Link, compat-libgmp https://drive.google.com/file/d/0B7S255p3kFXNZFJDdWtkV3RyZTA/view?usp=sharing ... and compat-libmpfr https://drive.google.com/file/d/0B7S255p3kFXNV0FoOVlPemRBS0k/view?usp=sharing

# cd Downloads/ && yum install compat-libgmp-4.3.1-1.sl7.x86_64.rpm compat-libmpfr-2.4.1-1.sl7.x86_64.rpm


2) No need for the complete devtoolset-3. This will install gcc-4.9 / g++-4.9 : # yum install devtoolset-3-gcc-c++ ... total ~4 packages. ... 'gfortran' : # yum install devtoolset-3-gcc-gfortran

Enabling gcc-4.9, g++-4.9 : $ scl enable devtoolset-3 bash ... and $ gcc -v will say "gcc version 4.9" ( The setting is valid until you exit the terminal.)


Knud Larsen

Posted 2016-06-13T10:15:25.397

Reputation: 641

Now my application installation fails with this error. /opt/rh/devtoolset-3/root/usr/libexec/gcc/x86_64-redhat-linux/4.9.1/ld: cannot find -lgfortran /opt/rh/devtoolset-3/root/usr/libexec/gcc/x86_64-redhat-linux/4.9.1/ld: cannot find -lquadmath. I think, I need to install other tools devtoolset-3 as well. This requires further libraries like libboost_system-mt.so.5. Could you please let me know from where you got compat-libgmp-4.3.1-1.sl7.x86_64.rpm and compat-libmpfr-2.4.1-1.sl7.x86_64.rpm? – Samuel Alexander – 2016-06-13T13:28:02.187

Packages compat-libgmp, compat-libmpfr were built with rpmbuild -bb [name].spec from the original EL6 packages, gmp and mpfr. Only difference : Conflicting files were removed from "compat-libgmp". And : The name was changed : Not possible to install packages with the same name as the system { gmp, mpfr }. - – Knud Larsen – 2016-06-13T13:37:23.483

1

libquadmath : I'd guess the package devtoolset-3-libquadmath-devel should be installed automatically with # yum install devtoolset-3-gcc-gfortran ? ... Else : 1) # yum install libquadmath ... 2) Download devtoolset-3-libquadmath-devel ftp://ftp.pbone.net/mirror/ftp.scientificlinux.org/linux/scientific/7x/external_products/softwarecollections/x86_64/devtoolset/devtoolset-3-libquadmath-devel-4.9.2-6.el7.x86_64.rpm , and install it with yum . I have no RHEL account, so I downloaded all six packages from http://rpm.pbone.net/ . -

– Knud Larsen – 2016-06-13T16:10:49.427