在 ubuntu 18.04 上安装 gcc 4.9

在 ubuntu 18.04 上安装 gcc 4.9

有没有办法在 ubuntu 18.04 上安装 gcc 4.9?我试过了

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

但我得到:

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

我需要这个版本来运行狙击手的一些模拟。有什么办法吗,还是我必须用 ubuntu 16.04 制作虚拟机?

答案1

可用的有:sudo apt install g++-4.8

还有没有 PIE gcc54-c++_5.4.0-ubuntu16_amd64.deb https://drive.google.com/file/d/1ptHLaZXImpeMzq4xuuGGn5VjrvxNSop3/view?usp=sharing参考。 https://stackoverflow.com/questions/50213089/linking-error-with-gcc-g-7-3-0-on-ubuntu-18-04/50232797#50232797→ 我的答案。

或者暂时xenial添加:/etc/apt/sources.listsudo gedit /etc/apt/sources.list

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

...并做到sudo apt update && sudo apt install g++-4.9

答案2

在服务器模式下,默认安装不会在源列表中添加 universe 存储库,并且主目录中只有 gcc8 和 gcc7 可用。添加 universe 存储库,更新存储库并安装 gcc4.8

相关内容