Friday, August 21, 2015

How to install gcc 4.7 on Ubuntu LTS12?

Question:
I have gcc 4.6 installed on Ubuntu LTS 12.04. How can I upgrade to gcc 4.7?


NOTE!!
You also most likely need to take care of g++-4.7 as well.

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

No comments:

Post a Comment