Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What would be the easiest way to install gcc 4.7 on a system with CentOS 6.2 ? The refault rpm package contains an older version of gcc.

share|improve this question

3 Answers

Tru Huynh of centos.org has built the redhat developer toolset 1.1, for centos and it contains gcc 4.7.2

So you could simply use his repo and install just gcc, instantly.

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++

This will install it most likely into /opt/centos/devtoolset-1.1/root/usr/bin/

Then you can tell your compile process to use the gcc 4.7 instead of 4.4 with the CC variable

export CC=/opt/centos/devtoolset-1.1/root/usr/bin/gcc  
export CPP=/opt/centos/devtoolset-1.1/root/usr/bin/cpp
export CXX=/opt/centos/devtoolset-1.1/root/usr/bin/c++
share|improve this answer
1  
running yum --enablerepo=testing-devtools-6 install devtoolset-1.1-gcc devtoolset-1.1-gcc-c++ returns a four-o-four, .. : image – The Pet Mar 12 at 7:28
Thanks for reporting that, looks like he changed the url and repo name slightly for 1.1 and I had just edited it from 1.0 - I fixed it now, I think people.centos.org/tru/devtools-1.1 – ck_ Mar 12 at 10:45
don't forget to yum clean all before doing the steps again after failure else you will still get 404 – The Pet Mar 12 at 11:18
instead of setting individual variables you can do scl enable devtoolset-1.1 bash (it starts new shell with all variables set). – marcin Mar 28 at 11:42

From what I can see from the gnu gcc, latest stable version is 4.62. The version 4.7 can be downloaded and compiled, more info on the gcc installation.

share|improve this answer
I asked about 4.7 because it is supposed to have some C++11 features that I need (porting from Clang). – TomA Jan 22 '12 at 19:01
So apart from compiling from source there is no, say, website that would have some rpms I could use? – TomA Jan 22 '12 at 19:02
Not that I'm aware of, but I'm not very knowledgeable on the topic. RPM repository typicly include the RPM only in it's stable form. – bbaja42 Jan 22 '12 at 20:28

One way of achieving this would be to fetch src RPMs from the fedora repositories and recompile them for your target system.
Fedora 17 and later provide gcc 4.7

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.