Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have Ubuntu 10.04 32-bit with gcc 4.4.3 currently installed on it. I want to upgrade it to gcc 4.6.1.

  1. How to update using Ubuntu Package Manager:

    apt-get upgrade/install
  2. As a second option I downloaded the latest gcc snapshot file from:

How do I configure, compile, and install it?

share|improve this question
Btw, Ubuntu specific questions can also be asked at Ask Ubuntu StackExchange site. – Ilari Kajaste Jul 15 '11 at 7:28
up vote 9 down vote accepted

I think you can get it by adding this PPA to your repositories:

You can add the PPA by running

sudo add-apt-repository ppa:ubuntu-toolchain-r/test

After it's in the repositories (and after running apt-get update) you should be able to either 1) update to the latest version using apt-get upgrade, or possibly 2) you'll have it available as a separate package you need to you'll need to apt-get install. I'm not sure which is the case with this package.

Further information: Guide on how to add a PPA to your repositories.

share|improve this answer
Did not work. After sudo add-apt-repository ppa:ubuntu-toolchain-r/test and sudo apt-get update, both sudo apt-get upgrade gcc and sudo apt-get upgrade g++-4.7 did nothing. I have a stock 11.10 64bit install. – voltrevo Dec 23 '11 at 21:44

Add to your repositories by running:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test

Then follow the steps on AskUbuntu to map gcc to the version you just installed.

In our case, you want to run:

sudo apt-get update
sudo apt-get install gcc-4.6
sudo apt-get install g++-4.6
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 20
sudo update-alternatives --config gcc
sudo update-alternatives --config g++
share|improve this answer
+1, this worked for me. The last line needs code formated but it wasn't a big enough edit to allow the change. – N Rahl Apr 26 '12 at 17:49
Why isn't this the selected answer? – pyler Jul 13 at 16:27

You don't get latest anything on LTS with the package manager. It's supposed to be stable with backported security updates. I'm not a fan of updating distros, I just reinstall and copy ~/

make install  

is the general procedure. Read the options in the configure have to have a version installed to compile a new one. make install will probably mangle your current install.

suggestion: if you want "newest" then use "newest" - that's 11.10 at this point I think.

share|improve this answer
Have you mentioned updating Ubunut itself. That's not what I am looking for. I am looking to upgrade gcc installed on my ubuntu. – goldenmean Jul 15 '11 at 6:44
not a good idea and it may cause many problems later. – RobotHumans Jul 15 '11 at 6:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .