v11
v11

Reputation: 2234

How to install gcc 4.7.3 on CentOS?

I want to install gcc 4.7.3 on centos, but I use yum search gcc like that:

yum search gcc

it show me too many information to choose:

gcc-c++.x86_64 : C++ support for GCC
gcc-gnat.x86_64 : Ada 95 support for GCC
gcc-objc.x86_64 : Objective-C support for GCC
gcc-objc++.x86_64 : Objective-C++ support for GCC
gcc-plugin-devel.x86_64 : Support for compiling GCC plugins
libgcc.i686 : GCC version 4.8 shared support library
libgcc.x86_64 : GCC version 4.8 shared support library
relaxngcc-javadoc.noarch : Javadoc for relaxngcc
compat-gcc-44.x86_64 : Compatibility GNU Compiler Collection
compat-gcc-44-c++.x86_64 : C++ support for compatibility compiler

I don't know which one is gcc 4.7.3. I want to write install to Dokcerfile, please tell me how to install it in simple way. just using command via Terminal Then,I using the command:

yum instal gcc-4.7.3

It show :

Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
base                                                     | 3.6 kB     00:00     
extras                                                   | 3.4 kB     00:00     
updates                                                  | 3.4 kB     00:00     
Loading mirror speeds from cached hostfile
 * base: mirror.neu.edu.cn
 * extras: mirror.neu.edu.cn
 * updates: mirror.neu.edu.cn
No package gcc-4.7.3 available.
Error: Nothing to do

Upvotes: 1

Views: 6146

Answers (1)

fury.slay
fury.slay

Reputation: 1258

I believe it is not possible to get 4.7.3 with devtools, instead, the devtools package would install you a gcc version 4.7.2.

devtoolset-1.1 package contains gcc-4.7.2

Follow the below commands to install devtoolset.

cd /etc/yum.repos.d
wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo
yum --enablerepo=testing-1.1-devtools-6 install devtoolset-1.1-gcc devtoolset-1.1-gcc-c++

gcc is located in /opt/centos/devtoolset-1.0/root/usr/bin/ and so you will have to update $PATH

export PATH=/opt/centos/devtoolset-1.0/root/usr/bin/:$PATH

Now the gcc version should be version 4.7.2

You can check it using gcc -v command.

NOTE: There is an option for you download the source and build to get the latest changes in the devtoolset package.

Upvotes: 1

Related Questions