I am not familiar with Ubuntu and I want to install old version (3.3) of gcc to compile some code. When I tried with

sudo apt-get install gcc-3.3

it's not installing.

~$ sudo apt-get install gcc-3.3
sudo: /etc/sudoers.d is world writable
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'gcc-3.3-hppa64' for regex 'gcc-3.3'
The following packages were automatically installed and are no longer required:
  gfortran-5 libamd2.4.1 libbtf1.2.1 libcamd2.4.1 libccolamd2.9.1
  libcholmod3.0.6 libcsparse3.1.4 libcxsparse3.1.4 libgfortran-5-dev
  libklu1.3.3 libldl2.2.1 libspqr2.0.2 libumfpack5.7.1 openjdk-9-jdk-headless
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.

When I tried to list all the available versions of gcc,

 sudo apt-cache search gcc

it's not listing gcc 3.3. How do I install gcc 3.3 on my Ubuntu?

My current gcc version is:

~$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
  • gcc 3.3 is ancient. You will probably need to rebuild it from scratch on your system, assuming that's even possible. A binary might install, though probably won't. Are you sure a more recent version of gcc won't work for you? Jun 29, 2017 at 10:17
  • I got debian repository and added it to /etc/apt/sources.list. It works for me Jun 30, 2017 at 3:44

4 Answers 4


download, compile, and install GCC from source

i typically get the tar.gz one; you can get the source from one of the mirror sites listed from gcc.gnu.org https://gcc.gnu.org/mirrors.html

tar -xf gcc-3.3.6.tar.gz
./configure --prefix=/usr/local/gcc-3.3.6
make install

adjust "--prefix=/usr/local/gcc-3.3.6" accordingly; i prefer to be explicit it makes things easier knowing where everything is. I think if not specified it will default to /usr/local/bin

you can do a ./configure --help to get a description of all the options available; prefix= is simply where it will get installed when doing make install and will also tell of the default install location if "prefix=" is not specified.

when using --prefix= you then need to supersede this local installation of whatever you did in your PATH and LD_LIBRARY_PATH environment variables like this

*for bash*
export PATH=/usr/local/gcc-3.3.6/bin:${PATH}
export LD_LIBRARY_PATH=/usr/local/gcc-3.3.6/lib:${LD_LIBRARY_PATH}

*for csh or tcsh*
setenv PATH /usr/local/gcc-3.3.6/bin:${PATH}
setenv LD_LIBRARY_PATH /usr/local/gcc-3.3.6/lib:${LD_LIBRARY_PATH}

either open a new terminal window or first type rehash

then a which gcc will let you know the version of gcc you would be using without manually and explictly having to do /usr/local/gcc-3.3.6/bin/gcc to use it.

whenever running executables later on that have been compiled with a newer/older version of GCC make sure your LD_LIBRARY_PATH is correctly set to that corresponding GCC version.

during the ./configure step that will let you know if you are missing prerequisites so don't be alarmed if this step isn't 100% successful on first try, you will either need to download and install them or disable them by looking it up from the output of ./configure --help

  • this way you can have multiple gcc versions to your heart's content, keep each gcc install separate using --prefix=
  • adjust LD_LIBRARY_PATH, and PATH, accordingly to use whichever

You can download the debian package from here


and install with

sudo dpkg -i /path/to/package
  • There are two folders when I downloaded package from this link, DEBIAN and usr. Which path should I give? Jun 29, 2017 at 9:34
  • This link will download the .deb file. Use the path to the .deb package. Don't extract it. Jun 29, 2017 at 9:45

It seems that Launchpad has recent builds of gcc 3.3 available. I don't know if this is recent enough to work, but I suppose it's worth a try.

If you need further elaboration, please comment.


I've added Debian repository to /etc/apt/source.

    deb     http://snapshot.debian.org/archive/debian/20070730T000000Z/ lenny main
deb-src http://snapshot.debian.org/archive/debian/20070730T000000Z/ lenny main
deb     http://snapshot.debian.org/archive/debian-security/20070730T000000Z/ lenny/updates main
deb-src http://snapshot.debian.org/archive/debian-security/20070730T000000Z/ lenny/updates main

Then I searched gcc by using

sudo apt-cache search gcc

Then it listed gcc-3.3 then I installed

sudo apt-get install gcc-3.3 g++-3.3

Then I've changed the symbolic link of gcc to select gcc 3.3

  • Are you able to switch between gcc-3 and gcc-5?
    – GAD3R
    Jun 30, 2017 at 12:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .