Ubuntu – Install gcc 4.9 at ubuntu 18.04

18.04gcc

Is there any way to install gcc 4.9 at ubuntu 18.04? I tried

sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
sudo apt-get update
sudo apt-get install gcc-4.9 g++-4.9

but I get:

Package g++-4.9 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

I need this version for running some simulations with sniper.
Is there anyway to do it or I have to make a VM with ubuntu 16.04?

Best Answer

Available is: sudo apt install g++-4.8

And the no PIE gcc54-c++_5.4.0-ubuntu16_amd64.deb https://drive.google.com/file/d/1ptHLaZXImpeMzq4xuuGGn5VjrvxNSop3/view?usp=sharing , Ref. https://stackoverflow.com/questions/50213089/linking-error-with-gcc-g-7-3-0-on-ubuntu-18-04/50232797#50232797 → My answer.

Or add xenial to /etc/apt/sources.list temporarily : sudo gedit /etc/apt/sources.list

deb http://dk.archive.ubuntu.com/ubuntu/ xenial main
deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe

... and do sudo apt update && sudo apt install g++-4.9

Related Question