Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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 4.5.2 installed from the Ubuntu official repositories. I would like to install 4.6 as well to try out the C++0x features it brings.

How can I do this without breaking my system? I'm fine with the newer being default, but also want to keep the older version.

share|improve this question
up vote 2 down vote accepted

If you know your way around the command line, you should be able to compile from source and set the configuration to install in /opt.

Something along the lines of ./configure --prefix=/opt.

share|improve this answer

I don't think that there is any way to do this via dpkg or the apt package management system. Thus, your option of resort is to compile from source, making this less of an Ubuntu question, and more of a gcc question. I am sure that

  1. Compiling gcc from source is a fairly involved process, especially with special requirements such as yours.
  2. There are plenty of tutorials on the matter.

A good lead is to research setting up a "cross compiler", which in your case would use the same hardware architecture as your normal gcc.

share|improve this answer

Your Answer


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.