不知何故,gcc-7 和 gcc-9 都从我的 Ubuntu 18.04.4 arm64 系统中删除了,我们需要它们来编译我们的代码。对我来说,似乎自 2020 年 4 月 5 日起对 libgcc-s1 的更新破坏了 18.04 中对 arm64 的兼容性。有人有解决方案或解决方法吗?
当我尝试重新安装它们时,我得到:
$ sudo apt-get install gcc-9 g++-9 gcc-7 g++-7
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:
g++-7 : Depends: libstdc++-7-dev (= 7.5.0-3ubuntu1~18.04) but it is not going to be installed
g++-9 : Depends: libstdc++-9-dev (= 9.2.1-17ubuntu1~18.04.1) but it is not going to be installed
gcc-7 : Depends: libgcc-7-dev (= 7.5.0-3ubuntu1~18.04) but it is not going to be installed
gcc-9 : Depends: libgcc-9-dev (= 9.2.1-17ubuntu1~18.04.1) but it is not going to be installed
如果我尝试安装这些依赖项,我会得到:
$ sudo apt install libstdc++-9-dev libgcc-9-dev libstdc++-7-dev libgcc-7-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-s1 : Breaks: libgcc-7-dev (< 7.5.0-4) but 7.5.0-3ubuntu1~18.04 is to be installed
Breaks: libgcc-9-dev (< 9.2.1-26) but 9.2.1-17ubuntu1~18.04.1 is to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
我已检查没有被保留的软件包,并且未发现 libgcc-s1 的可用更新。我正在使用 repo ubuntu-toolchain-r/test
,我的 libgcc-s1 是版本 10-20200405-0ubuntu1~18.04。
更新 07/08:我们更新了我们的代码以兼容 gcc10 g++10,并且能够成功安装它们。
答案1
我在安装 openjdk13 时遇到同样的问题:
The following packages have unmet dependencies:
openjdk-13-jre-headless : Depends: libgcc-s1 (>= 4.0) but it is not installable
在安装 openjdk 之前,我必须从 Dockerfile 中的 URL 安装 gcc-10-base 和 libgcc-s1:
RUN curl -sLO http://ftp.fr.debian.org/debian/pool/main/g/gcc-10/gcc-10-base_10-20200418-1_amd64.deb && dpkg -i gcc-10-base_10-20200418-1_amd64.deb
RUN curl -sLO http://ftp.fr.debian.org/debian/pool/main/g/gcc-10/libgcc-s1_10-20200418-1_amd64.deb && dpkg -i libgcc-s1_10-20200418-1_amd64.deb
答案2
首先,在页面中添加链接https://packages.debian.org/sid/arm64/gcc-9-base/download
到 /etc/apt/sources.list 其次,运行apt --fix-broken install
不带任何包名称的程序,重新启动并重新尝试安装您的包。