How do I install gcc 4.7?
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?
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?.
NOTE!!
You also most likely need to take care of g++-4.7
So the full commands list will be:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.7 g++-4.7
Also, don't forget to update-alternatives, as suggested here
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7
sudo update-alternatives --config gcc
This is confirmed to work in Ubuntu 12.04