2009-11-11

Install GCC 3.4 on Ubuntu 9.10 [UPDATED]

It seems that Karmic Koala, the last version of Ubuntu, has dropped support for versions of GCC/G++ prior to version 4.1.
Here is a quick script to add GCC and G++ 3.4 from the repository of the previous version:
mkdir DELEME
cd DELEME
wget http://ge.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-3.4/libstdc++6-dev_3.4.6-6ubuntu3_i386.deb
wget http://ge.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-3.4/cpp-3.4_3.4.6-8ubuntu2_i386.deb
wget http://ge.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-3.4/gcc-3.4_3.4.6-8ubuntu2_i386.deb
wget http://ge.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-3.4/gcc-3.4-base_3.4.6-8ubuntu2_i386.deb
wget http://ge.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-3.4/g++-3.4_3.4.6-6ubuntu3_i386.deb
sudo dpkg -i *.deb
cd ..
rm -rf DELEME
UPDATE: As of 2012-09-02, I have been warned that the previous installation process does not work any more; it appears that the repository does not contain all the required files, so it fails on the second one (cpp) producing error message 404 (Not Found).
I don't need this version of GCC right now so I am not going to try it myself, but a quick web search returned another alternative repository on Launchpad. But this new repository does not include the first and the last package (libstdc++ and g++), so only these will still have to be taken from the old location.
Then the installation process now becomes:

mkdir DELEME
cd DELEME
wget http://ge.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-3.4/libstdc++6-dev_3.4.6-6ubuntu3_i386.deb
wget https://launchpad.net/~yofel/+archive/off-ppa/+files/cpp-3.4_3.4.6-8ubuntu2_i386.deb
wget https://launchpad.net/~yofel/+archive/off-ppa/+files/gcc-3.4_3.4.6-8ubuntu2_i386.deb
wget https://launchpad.net/~yofel/+archive/off-ppa/+files/gcc-3.4-base_3.4.6-8ubuntu2_i386.deb
wget http://ge.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-3.4/g++-3.4_3.4.6-6ubuntu3_i386.deb
sudo dpkg -i *.deb
cd ..
rm -rf DELEME