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
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Best Answer
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.htmladjust "--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 doingmake 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 yourPATH
andLD_LIBRARY_PATH
environment variables like thiseither 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
--prefix=
LD_LIBRARY_PATH
, andPATH
, accordingly to use whichever