После обновления экземпляра wsl2 до Ubuntu 20 LTS пакеты, такие как build-essential, не могут быть установлены

Если

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 build-essential : Depends: gcc (>= 4:9.2) but it is not going to be installed
                   Depends: g++ (>= 4:9.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Если копать глубже

❯ sudo apt-get install -f libgcc-9-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libgcc-9-dev : Depends: libitm1 (>= 9.3.0-10ubuntu2) but it is not going to be installed
                Depends: libatomic1 (>= 9.3.0-10ubuntu2) but it is not going to be installed
                Depends: liblsan0 (>= 9.3.0-10ubuntu2) but it is not going to be installed
                Depends: libtsan0 (>= 9.3.0-10ubuntu2) but it is not going to be installed
                Depends: libubsan1 (>= 9.3.0-10ubuntu2) but it is not going to be installed
                Depends: libquadmath0 (>= 9.3.0-10ubuntu2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
❯ sudo apt-get install -f libasan5 libatomic1 libgcc-s1
Reading package lists... Done
Building dependency tree
Reading state information... Done
libgcc-s1 is already the newest version (10.1.0-2ubuntu1~18.04).
libgcc-s1 set to manually installed.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libatomic1 : Depends: gcc-10-base (= 10-20200411-0ubuntu1) but 10.1.0-2ubuntu1~18.04 is to be installed
E: Unable to correct problems, you have held broken packages.

Как решить эту проблему цепочки зависимостей? заставить его использовать последние пакеты или перейти на рекомендуемые версии?

1
задан 2 July 2020 в 23:04

1 ответ

Как упоминалось @ user535733, понижение намного проще. Мне удается понизить все зависимости и установить правильную версию gcc. Хитрость заключается в том, чтобы использовать aptitude , который предлагает более богатые возможности, чем apt .

sudo apt install aptitude
sudo aptitude update && sudo aptitude install build-essential

Это дает мне:

      Install the following packages:
1)      tcc [0.9.27-8 (focal)]

      Keep the following packages at their current version:
2)      build-essential [Not Installed]
3)      g++ [Not Installed]
4)      g++-9 [Not Installed]
5)      gcc [Not Installed]
6)      gcc-9 [Not Installed]
7)      libatomic1 [Not Installed]
8)      libgcc-9-dev [Not Installed]
9)      libitm1 [Not Installed]
10)     liblsan0 [Not Installed]
11)     libquadmath0 [Not Installed]
12)     libstdc++-9-dev [Not Installed]
13)     libtsan0 [Not Installed]
14)     libubsan1 [Not Installed]

Что не является тем, чего мы хотим, , поэтому введите n

Тогда aptitude предложит другое решение, которое выглядит следующим образом:

The following actions will resolve these dependencies:

     Downgrade the following packages:
1)     gcc-10-base [10.1.0-2ubuntu1~18.04 (now) -> 10-20200416-0ubuntu1 (focal)]
2)     libcc1-0 [10.1.0-2ubuntu1~18.04 (now) -> 10-20200416-0ubuntu1 (focal)]
3)     libgcc-s1 [10.1.0-2ubuntu1~18.04 (now) -> 10-20200416-0ubuntu1 (focal)]
4)     libgcc1 [1:10.1.0-2ubuntu1~18.04 (now) -> 1:10-20200416-0ubuntu1 (focal)]
5)     libgomp1 [10.1.0-2ubuntu1~18.04 (now) -> 10-20200416-0ubuntu1 (focal)]
6)     libstdc++6 [10.1.0-2ubuntu1~18.04 (now) -> 10-20200416-0ubuntu1 (focal)]



Accept this solution? [Y/n/q/?] Y

Мы можем принять этот план и затем подтвердить установку.

Setting up build-essential (12.8ubuntu1) ...

Когда вы видите строку выше, это сделано! Поздравляем!

1
ответ дан 30 July 2020 в 22:14

Другие вопросы по тегам:

Похожие вопросы: