First thing to try is whether the old packages install without conflicts. It is quite normal to have multiple GCC's installed.
To install old packages, add the old repositories to your /etc/apt/sources.list. Do a apt-get update. While installing, specify the version.
Code:
apt-get install -t 2.2.5 libc6
In order to discover the right name and version for the package, do
Code:
apt-cache show libc6
(You have to search around a bit to discover that glibc is in the libc6. apt-cache search is your friend)
Alternatively you can track down and download the .deb files and install them with dpkg. But dpkg does not install the dependencies automatically. Apt-get -f install won't work if you do not have the correct repos installed, so you have to install them anyway.
There is a fair chance that installing old versions will work if your installation is not too old. Some packages cannot co-exist and require you remove newer versions. Usually that is a dead end, because you end up removes hundreds of dependencies.
I just don't know how to add repos to Ubuntu. I am a Debian person and maybe Ubuntu designed something more user friendly (=opaque, less transparant, automatic, less option)