Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing older version of gcc [closed]

Tags:

c++

c

linux

gcc

ubuntu

I want to install gcc 4.1.2 on my Ubuntu 64 bit system, which currentcly has gcc 4.4. I want to keep on using the current gcc, but want to add gcc 4.1.2 as well. Any simple way to do it, that is install gcc 4.1.2 on my system?

like image 362
MetallicPriest Avatar asked Oct 21 '11 20:10

MetallicPriest


2 Answers

Easy, just take it from an archive of the older Ubuntu releases. For example, my machine (still running natty) has

edd@max:~$ ls -l /usr/bin/g++-*
-rwxr-xr-x 1 root root 242752 2010-09-10 04:16 /usr/bin/g++-4.3
-rwxr-xr-x 1 root root 263240 2011-03-31 15:22 /usr/bin/g++-4.4
-rwxr-xr-x 1 root root 275856 2011-04-18 09:25 /usr/bin/g++-4.5
edd@max:~$

The 4.1.* series had some issues. Even g++-4.2.1, the default on OS X, is not all that great. But you should definitely have the option of installing this.

When you do this, by all means go the package management route of installing proper dependencies. You will get matching packages for the other dependencies too.

In other words, you need to adjust /etc/apt/sources.list to point to an older release that had this version.

like image 133
Dirk Eddelbuettel Avatar answered Sep 27 '22 20:09

Dirk Eddelbuettel


sudo apt-get install gcc-4.1=4.1.2 gcc-4.4

seems the straightforward solution to me. Since @DirkEddelbuettel noted that newer Ubuntu distributions dropped it, add an older distribution that has gcc-4.1 to your /etc/apt/sources.list. The Ubuntu people maintain a great website for looking that up; hardy, lucid and maverick seem great.

like image 33
thiton Avatar answered Sep 27 '22 20:09

thiton