Ubuntu 22.04 和 GCC < 11

Ubuntu 22.04 和 GCC < 11

我已经安装了新的 Ubuntu 22.04,结果发现它使用的是 gcc/g++11:

g++ --version
g++ (Ubuntu 11.2.0-19ubuntu1) 11.2.0

现在,这对于许多安装脚本都不起作用,我希望有一种方法可以在我的系统上至少保留 2-3 个以上的 gcc/g++ 版本。我可以在 Ubuntu 20.04 上自己完成此操作。但在这个上,它一直告诉我树上没有这样的包。

sudo apt -y install gcc-7 g++-7 gcc-8 g++-8 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package g++-8 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

Package g++-7 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

Package gcc-8 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

Package gcc-7 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

E: Package 'gcc-7' has no installation candidate
E: Package 'g++-7' has no installation candidate
E: Package 'gcc-8' has no installation candidate
E: Package 'g++-8' has no installation candidate

我尝试过添加

sudo add-apt-repository universe

同样,没有运气。有办法破解这个吗?如果我们无法安装以前版本的 gcc/g++,那就太傻了。这将是完全删除 22.04 的一个原因。

相关内容