I installed Lubuntu 11.10 and I installed build-essential with this command:

sudo apt-get install build-essential

Now I have gcc 4.6

I read on some forum that adding the next PPA I'll be able to install gcc 4.7:

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

I did that, then ran:

sudo apt-get update
sudo apt-get install gcc-4.7

But my machine can't find the gcc-4.7 package? Any suggestion?


ppa:ubuntu-toolchain-r/test is the wrong PPA unless your aim is to test new, experimental packages that might be vastly unstable. Furthermore, since that PPA is just a sandbox for testing, there's no particular package that's ever necessarily in there. Packages come and go.

  • At the time of this posting, the only package that PPA provides for Oneiric (11.10) is libatomic-ops.

If you want to install PPA-provided toolchain builds, for any purpose except testing new toolchain-r packages, the "toolchain-r" team provides this repository:

However, that does not provide gcc-4.7 on Oneiric. It provides it for Quantal, but not Oneiric.

Searching for another PPA on Launchpad didn't reveal anything for me. You might be able to install a package intended for another release (or for Debian), but especially with a compiler suite, this runs the risk of not working...or not working entirely, such that you might not discover the problem until much later.

Installing the Upstream Version

Your best bet might be to install an upstream GCC 4.7. You can download and install it from any GCC mirror. For example, you can get GCC 4.7.2 here.

Bootstrapping/building GCC from upstream sources is somewhat time consuming and slightly more involved than building most software from source, but it's not too difficult. Check out the documentation that comes in the source archive. Most problems have solutions and you can search for them. Feel free to post questions here if you have trouble!


Alternatively, you may wish to create a full directory structure for a minimal Ubuntu system of a later version that has GCC 5.7, like 12.10 Quantal. debootstrap facilitates this. Check out this guide for debootstrap in Ubuntu. See also this question (applies to later versions of Ubuntu as well as earlier versions).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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