I need gcc-4.2 on Ubuntu Trusty.
Building gcc 4.2 is not an option so I need to get it through a repository(it's part of a Travis CI build for project mutator so I can't really build it).
I looked around and apparently Hardy(deb http://old-releases.ubuntu.com/ubuntu/ hardy universe) used to have that so I figured I just need to add that to the apt list but I get this:

Package gcc-4.2 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

So I looked around some more and couldn't find another repo with that package. Any ideas?


The difference between Hardy and Trusty is quite big. Too big to do so-called apt-pinning.

It seems to me that the easiest and cleanest solution is to install Hardy in a Virtual Machine, and install gcc 4.2 there.

For example, after downloading the Hardy iso image and installing Qemu/KVM. Assuming you can run KVM (Otherwise just run plain Qemu or use VirtualBox) :

qemu-img -f qcow2 hardy-hdd.qcow2 15G
kvm -hda hardy-hdd.qcow2 -cdrom ubuntu-8.04-desktop-amd64.iso -boot d -m 1024 

The first line created a virtual hard disk of 15 Gb called hardy-hdd.qcow2

The second line boots up the iso cdrom image, in order to install Ubuntu Hardy in the virtual hdd.

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.