如何修复 gcc 上未满足的依赖关系?

如何修复 gcc 上未满足的依赖关系?

我最近升级到了 Ubuntu 20.04 LTS。升级后,我发现 GCC 坏了。我猜我的 GCC 相关软件包是从另一个 PPA 安装的。我将所有额外的 PPA 都从列表中删除,然后尝试重新安装未满足的依赖项。

不幸的是,我无法使用 安装或删除软件包apt。我总是收到一条消息:

$ sudo apt install --reinstall gcc-10-base
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 gcc-10-base : Breaks: gcc-10-base:i386 (!= 10-20200411-0ubuntu1) but 10.1.0-2ubuntu1~18.04 is to be installed
 gcc-10-base:i386 : Breaks: gcc-10-base (!= 10.1.0-2ubuntu1~18.04) but 10-20200411-0ubuntu1 is to be installed
 libatomic1 : Depends: gcc-10-base (= 10.1.0-2ubuntu1~18.04) but 10-20200411-0ubuntu1 is to be installed
 libcc1-0 : Depends: gcc-10-base (= 10.1.0-2ubuntu1~18.04) but 10-20200411-0ubuntu1 is to be installed
 libgcc-s1 : Depends: gcc-10-base (= 10.1.0-2ubuntu1~18.04) but 10-20200411-0ubuntu1 is to be installed
 libgcc1 : Depends: gcc-10-base (= 10.1.0-2ubuntu1~18.04) but 10-20200411-0ubuntu1 is to be installed
 libgomp1 : Depends: gcc-10-base (= 10.1.0-2ubuntu1~18.04) but 10-20200411-0ubuntu1 is to be installed
 libitm1 : Depends: gcc-10-base (= 10.1.0-2ubuntu1~18.04) but 10-20200411-0ubuntu1 is to be installed
 liblsan0 : Depends: gcc-10-base (= 10.1.0-2ubuntu1~18.04) but 10-20200411-0ubuntu1 is to be installed
 libquadmath0 : Depends: gcc-10-base (= 10.1.0-2ubuntu1~18.04) but 10-20200411-0ubuntu1 is to be installed
 libstdc++6 : Depends: gcc-10-base (= 10.1.0-2ubuntu1~18.04) but 10-20200411-0ubuntu1 is to be installed
 libtsan0 : Depends: gcc-10-base (= 10.1.0-2ubuntu1~18.04) but 10-20200411-0ubuntu1 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

我如何强制重新安装依赖项?

答案1

就我而言,这与 clang-10 有关。我建议卸载它并删除它的 ppa(因为它现在默认提供),然后运行类似于以下内容的操作:

sudo apt install clang-10/focal libstdc++-9-dev/focal libgcc-9-dev/focal libobjc-9-dev/focal libclang-common-10-dev/focal libclang1-10/focal llvm-10-dev/focal libomp-10-dev/focal gcc-9-base/focal libasan5/focal gcc-9-base/focal chrome-gnome-shell/focal cpp/focal  cpp-9/focal debhelper/focal dh-autoreconf/focal gdm3/focal gnome-control-center/focal gnome-initial-setup/focal gnome-settings-daemon/focal gnome-shell/focal gnome-shell-extension-appindicator/focal gnome-shell-extension-desktop-icons/focal gnome-shell-extension-prefs/focal gnome-shell-extension-ubuntu-dock/focal gnome-tweak-tool/focal gnome-tweaks/focal libtool/focal ubuntu-desktop/focal ubuntu-desktop-minimal/focal ubuntu-session/focal x11-xserver-utils/focal xorg/focal

基本上就是告诉包管理器,是的,你确实想要所有这些内容的所有焦点版本。我认为有人破坏了这些内容的版本控制,因为我收到了一些降级警告。

如果你不想要 clang-10,你可以尝试:

sudo apt install libstdc++-9-dev/focal libgcc-9-dev/focal libobjc-9-dev/focal libclang-common-10-dev/focal libomp-10-dev/focal gcc-9-base/focal libasan5/focal gcc-9-base/focal chrome-gnome-shell/focal cpp/focal  cpp-9/focal debhelper/focal dh-autoreconf/focal gdm3/focal gnome-control-center/focal gnome-initial-setup/focal gnome-settings-daemon/focal gnome-shell/focal gnome-shell-extension-appindicator/focal gnome-shell-extension-desktop-icons/focal gnome-shell-extension-prefs/focal gnome-shell-extension-ubuntu-dock/focal gnome-tweak-tool/focal gnome-tweaks/focal libtool/focal ubuntu-desktop/focal ubuntu-desktop-minimal/focal ubuntu-session/focal x11-xserver-utils/focal xorg/focal

但上述内容我还没有测试过。

您可能需要向此行添加其他包才能使其工作,无论如何,只需将其抱怨的包添加/focal到上面的行即可。

请务必阅读输出,以确保 apt 尚未决定需要删除一堆系统文件。这就是为什么我的示例中有这么多软件包的原因。

答案2

我使用 修复了这个问题aptitude。它在计算依赖项方面具有更好的体验。您需要先禁用源ubuntu-toolchain-r,然后使用 更新源并升级软件包aptitude

将会有多个关于如何升级软件包的建议。请记住选择用来自焦点源的软件包替换 gcc-10-base 和相关软件包的计划,或者其他符合您要求的计划。

相关内容