运行后sudo apt-get install libgmp-dev
我得到:
以下软件包具有未满足的依赖性:libgmp-dev:依赖:libgmp10(= 2:6.1.2+dfsg-1)但需要安装 2:6.1.2+dfsg-2 E:无法纠正问题,您持有损坏的软件包。
然后尝试安装libgmp10
:
sudo apt-get install libgmp10
...
libgmp10 is already the newest version (2:6.1.2+dfsg-2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
问题根源
我需要安装ruby-dev包运行后给出以下输出sudo apt install ruby-dev
:
The following packages have unmet dependencies:
ruby-dev : Depends: ruby2.3-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
然后继续sudo apt install ruby2.3-dev
:
The following packages have unmet dependencies:
ruby2.3-dev : Depends: libgmp-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
然后当我尝试运行原始命令时:sudo apt install libgmp-dev
有了上述输出,有什么想法吗?
附加信息
- Ubuntu 版本:artful
apt-cache policy libgmp-dev
给出:libgmp-dev: Installed: (none) Candidate: 2:6.1.2+dfsg-1 Version table: 2:6.1.2+dfsg-1 500 500 http://uy.archive.ubuntu.com/ubuntu artful/main amd64 Packages
apt-cache policy libgmp10
:libgmp10: Installed: 2:6.1.2+dfsg-2 Candidate: 2:6.1.2+dfsg-2 Version table: *** 2:6.1.2+dfsg-2 100 100 /var/lib/dpkg/status 2:6.1.2+dfsg-1 500 500 http://uy.archive.ubuntu.com/ubuntu artful/main amd64 Packages
答案1
rmadison
命令显示libgmp10
我安装的版本来自仿生的而不是来自巧。
$ rmadison libgmp10
libgmp10 | 2:5.0.2+dfsg-2ubuntu1 | precise | amd64, armel, armhf, i386, powerpc
libgmp10 | 2:5.1.3+dfsg-1ubuntu1 | trusty | amd64, arm64, armhf, i386, powerpc, ppc64el
libgmp10 | 2:6.1.0+dfsg-2 | xenial | amd64, arm64, armhf, i386, powerpc, ppc64el, s390x
libgmp10 | 2:6.1.2+dfsg-1 | artful | amd64, arm64, armhf, i386, ppc64el, s390x
libgmp10 | 2:6.1.2+dfsg-2 | bionic | amd64, arm64, armhf, i386, ppc64el, s390x
解决方案
安装所使用的特定版本巧, 那是sudo apt-get install libgmp10=2:6.1.2+dfsg-1
:
sudo apt-get install libgmp10=2:6.1.2+dfsg-1
...
The following packages will be DOWNGRADED:
libgmp10
0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 0 not upgraded.
Need to get 240 kB of archives.
After this operation, 4.096 B disk space will be freed.
Do you want to continue? [S/n] S
Get:1 http://uy.archive.ubuntu.com/ubuntu artful/main amd64 libgmp10 amd64 2:6.1.2+dfsg-1 [240 kB]
Fetched 240 kB in 1s (290 kB/s)
dpkg: warning: downgrading libgmp10:amd64 from 2:6.1.2+dfsg-2 to 2:6.1.2+dfsg-1
...
Preparing to unpack .../libgmp10_2%3a6.1.2+dfsg-1_amd64.deb ...
Unpacking libgmp10:amd64 (2:6.1.2+dfsg-1) over (2:6.1.2+dfsg-2) ...
Setting up libgmp10:amd64 (2:6.1.2+dfsg-1) ...
Processing triggers for libc-bin (2.26-0ubuntu2.1) ...