Ubuntu – Install gcc 5 under ubuntu 19.04

gcc

I am trying to install gcc 5 under ubuntu 19.04, so I can compile some old code. So far, I have only managed to install gcc 6, which does not fix the problem. Thanks.

Best Answer

gcc-5 is not included in the default 19.04 repositories. The easiest way to circumvent this problem in Ubuntu 19.04 is to install gcc-4.8 instead. Open the terminal and type:

sudo apt install gcc-4.8  

The hard way to solve this problem would be to download and install gcc-5 from 18.10 in 19.04, but there are three dependencies of gcc-5 in 18.10 that would have to be downloaded and installed too, so try installing gcc-4.8 the easy way way first. The dependencies of gcc-5 in 18.10 are cpp-5, gcc-5-base and libgcc-5-dev. These three dependencies of gcc-5 are also not available in the default Ubuntu 19.04 repositories.

If 18.10 is no longer supported, download and install gcc-5 from 18.04, and there are three dependencies of gcc-5 in 18.04 that have to be downloaded and installed too. The dependencies of gcc-5 in 18.04 are cpp-5, gcc-5-base and libgcc-5-dev.

gcc packages in 18.04:
gcc-5_5.5.0-12ubuntu1_amd64.deb
cpp-5_5.5.0-12ubuntu1_amd64.deb
gcc-5-base_5.5.0-12ubuntu1_amd64.deb
libgcc-5-dev_5.5.0-12ubuntu1_amd64.deb

Change directories with cd to the directory the contains the 4 .deb files that you downloaded and run the following command:

sudo apt install ./cpp-5_5.5.0-12ubuntu8_amd64.deb ./gcc-5-base_5.5.0-12ubuntu8_amd64.deb ./libgcc-5-dev_5.5.0-12ubuntu8_amd64.deb ./gcc-5_5.5.0-12ubuntu8_amd64.deb 
Related Question