2

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.

  • 2
    @MMoallemi99 The unique answer to the above linked duplicate question does not work on 19.04 because gcc-5 is not included in the default 19.04 repositories. – karel Aug 18 '19 at 14:38
  • I installed gcc-5, cpp-5, gcc-5-base, libgcc-5-dev, libasan2, and libmpx0. I was able to compile a sample hello_world.c program using gcc-5. However, I do not have the files under /usr/include/c++. Which package would give that? Thanks. – Lewis Goss Aug 20 '19 at 04:02

1 Answers1

2

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 
karel
  • 114,770
  • 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. – karel Aug 18 '19 at 14:54
  • Thanks for both idea, I tried sudo apt install gcc-4.8. No luck there. I will have to try to download and install gcc-5 and the 3 dependencies from 18.10. Thanks. – Lewis Goss Aug 19 '19 at 03:14
  • I installed gcc-5, cpp-5, gcc-5-base, libgcc-5-dev, libasan2, and libmpx0. I was able to compile a sample hello_world.c program using gcc-5. However, I do not have the files under /usr/include/c++. Which package would give that? Thanks. – Lewis Goss Aug 20 '19 at 03:44
  • libstdc++-5-dev - libstdc++-5-dev_5.5.0-12ubuntu8_amd64.deb – karel Aug 20 '19 at 05:02
  • Hot diggity! Thank you. – Lewis Goss Aug 21 '19 at 01:24