Installing older version of gcc using apt-get

7,025

The version you want to install needs to exist in repositories you have in your apt sources (/etc/apt directory contains various apt settings including added repositories). You can add a repository that you know that has the version you're looking for (or a PPA if you're on Ubuntu-derived distro).

You need to find the repository on the internet that has the version of the package (in this case gcc 3.2) and it should contain a line like:

deb http://example.org/debian version foobar

You should add that line to /etc/apt/sources.list and then do:

$ apt-get update
$ apt-get install gcc=3.2

Then it will find GCC 3.2 in your newly added repository. However, do note that it will most likely overwrite system's version of GCC and that can cause all sorts of trouble and is not advised unless you really know what you are doing or the system is just a virtual machine for running that particular software you need to build.

You might also need to add the GPG key for the repository and the website containing the sources.list line will likely contain information about how to do so.

Share:
7,025

Related videos on Youtube

CHID
Author by

CHID

passionate about programming

Updated on September 18, 2022

Comments

  • CHID
    CHID over 1 year

    i am trying to install GCC version 3.2 using apt-get. But it complains the following

    root@chid-VirtualBox:/home/chid/Downloads# apt-get install gcc=3.2
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    E: Version '3.2' for 'gcc' was not found
    

    I even tried with other version numbers found in the gcc website. But no luck. how to proceed with this.

  • Ramhound
    Ramhound almost 11 years
    Can you provide those commands to do so? This answer would be 100 times better if you did.
  • Behnam
    Behnam over 8 years
    @Bojan Markovic: can you please tell me how "to find the repository on the internet that has the version of the package"? EDIT: I need GCC 4.4.7 which was released on March 13, 2012.