Ubuntu: How do I install a specific lower minor version of gcc using package manager?


I am running an Ubuntu 14.04-4 64bit. gcc --version returns

(Ubuntu 4.8.4-2ubuntu1~14.04.1) 4.8.4  

Yet, I need version 4.8.2-10. What I tried:

  1. I found the specific gcc version in a debian snapshot repository.
  2. I adapted my /etc/apt/sources.list to contain the following two lines only:

    deb http://snapshot.debian.org/archive/debian/20131213T160912Z unstable main      deb-src http://snapshot.debian.org/archive/debian/20131213T160912Z unstable main  
  3. As suggested here I added the required key

  4. I did sudo apt-get -o Acquire::Check-Valid-Until=false update
  5. sudo apt-get remove gcc
  6. sudo apt-get install gcc. This returned:

     ...   Preparing to unpack .../gcc_4%3a4.8.2-1_amd64.deb ...   Unpacking gcc (4:4.8.2-1) ...   Processing triggers for man-db ( ...   Setting up gcc (4:4.8.2-1) ...  

Unfortunately, gcc --version still returned gcc (Ubuntu 4.8.4-2ubuntu1~14.04.1) 4.8.4

Removing and re-installing gcc-4.8 and gcc-4.8-base returned in an error (unmet dependencies) or a strange warning (uninstalling more than 700mb).

How can I install this specific gcc version?


You can find the packages you want over here and install them using gdebi.


You can have as many versions of gcc as you want, installed at the same time : The default versions for Ubuntu 14.04 are â†' â†'

$ sudo apt-get install g++-4.4 g++-4.6 g++-4.7 g++-4.8  

... where "4.8" = version 4.8.2 is the system compiler, /usr/bin/{ gcc, g++ }

Using one of the other compilers, examples : $ gcc-4.4 file.c ,,, $ export CC=gcc-4.4 CXX=g++-4.4 && [other command] ,,, like $ export CC=gcc-4.4 CXX=g++-4.4 && ./configure

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »