Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install an old version of gcc alongside to the current one ? (and where to find it)

Tags:

gcc

I would like to use an old version of gcc for one of my program (versions 3.* would be good), any idea how to do this?

like image 533
aurel_lab Avatar asked Sep 01 '25 17:09

aurel_lab


1 Answers

Just compile and install it somewhere and optionally add its location to your $PATH. Do this in a directory where you downloaded gcc source code:

$ contrib/download_prerequisites
$ cd ..
$ mkdir objdir
$ cd objdir
$ ../gcc/configure --enable-languages=c --disable-multilib --prefix=$HOME/gcc-4.6.2 # modify option to suit your needs
$ make -j8
$ make install

Run it in $HOME/gcc-4.6.2:

$ usr/local/bin/gcc --version

(or use make install DESTDIR=<DIR> instead of --prefix)

like image 105
Arkadiusz Drabczyk Avatar answered Sep 04 '25 09:09

Arkadiusz Drabczyk