Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I wish to install gcc 4.7 so that I can use some c++11 features.

I downloaded the source, ran ./configure and was told I needed GMP. Downloaded the code for that, hit ./configure and was told I needed m4. But I already have m4 (least that is what synamptic tells me).

What is going on and how can I fix it?

Running Ubuntu 11.10

share|improve this question
Does anyone know whether it is available in a PPA? – Rafał Cieślak Mar 17 '12 at 20:52

3 Answers

up vote 39 down vote accepted

You can try this PPA for installing gcc 4.7. Do note that it has packages only for 12.04 and not for 11.10.

Run the following commands in a terminal:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.7

Or, if you prefer a graphical way of installing a PPA, take a look at What are PPAs and how do I use them?.

share|improve this answer
1  
Worked perfectly, thanks again – soandos Apr 1 '12 at 6:46
If you want to replace gcc 4.6 and make gcc 4.7 the default gcc compiler, you have to follow these instructions – thegreendroid Nov 18 '12 at 2:32

Search the build directory for config.log files, and search those for the error message. That should give some clues.

BTW, if you don't need 4.7 precisely, you could try installing the gcc-snapshot package. That should have the features you need. It doesn't get installed in the standard place though, if I remember correctly.

share|improve this answer
Where does it get installed? – soandos Oct 30 '12 at 0:29
The full file-list (for 64-bit 12.10) is here: packages.ubuntu.com/quantal/amd64/gcc-snapshot/filelist – ams Oct 30 '12 at 11:33

This is a complete guide of how to build from sources gcc-4.7 on Ubuntu 12.04 64 bits:

http://solarianprogrammer.com/2012/04/13/building-gcc-4-7-on-ubuntu-12-04/

share|improve this answer
That guide makes the second common mistake given at gcc.gnu.org/wiki/InstallingGCC, making life far more complicated than it needs to be – Jonathan Wakely Feb 20 at 11:40

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.