우분투 22.04 및 GCC < 11

우분투 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를 완전히 제거하는 이유가 됩니다.

관련 정보