How can I get GCC 4.7 installed on Precise?
Solution 1:
I have created a PPA that contains a build of GCC 4.7 for Precise here:
ppa:george-edison55/gcc4.7-precise (Click here for instructions on using PPAs.)
To backport a package from one release to another is a relatively simple process assuming you have a Launchpad account and have registered your GPG key there.
Make sure you have the ubuntu-dev-tools package installed:
sudo apt-get install ubuntu-dev-tools
The syntax for running the backport command looks something like this:
backportpackage -s [new_release] -d [old_release] -u [ppa] [package_name]
The command above will backport [package_name]
from [new_release]
to [old_release]
and upload it to [ppa]
. Note that in this particular case you will need to backport not only gcc-4.7
but also gcj-4.7
and gcc-defaults
in that order.
Solution 2:
A slightly more easy way is to just utilize the Ubuntu Toolchain Uploaders (Restricted) Team's PPA of test builds, which has Toolchain builds (this includes gcc, etc.) of newer toolchains in older releases. The above link shows the Precise packages there but they do compile things.
The releases available include gcc 4.7, 4.8, 4.9, and 5, although I've only tested 4.7.
You can always backport your own gcc packages and such, but that can always take time.