• 操作系统:ubuntu20.04

错误现象

当我使用下行命令安装curl开发包时,一般来说是一键安装成功的,但是有时也会出现意想不到的问题。

sudo apt-get install libcurl4-openssl-dev

我在ubuntu20.04里就遇到了以下问题,导致安装失败:

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:
 libcurl4-openssl-dev : Depends: libcurl4 (= 7.58.0-2ubuntu3.24) but 7.68.0-1ubuntu2.14 is to be installed
E: Unable to correct problems, you have held broken packages.

根据提示,应该是依赖包libcurl4的版本号是7.58.0-2ubuntu3.24,但是呢,系统要安装的是7.68.0-1ubuntu2.14 ,导致 libcurl4-openssl-dev的依赖包装不上,最后导致安装失败。

解决办法

根据提示,应该是要安装上7.58.0-2ubuntu3.24版本的libcurl才能安装成功,一定要安装这个版本的才行,那么如何去指定版本号安装呢?如下所示:

sudo apt-get -f install libcurl4=7.58.0-2ubuntu3.24

执行命令,出现如下提示:

nvidia@ubuntu:~/git/deepbox$ sudo apt-get -f install libcurl4=7.58.0-2ubuntu3.24
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  apt-clone archdetect-deb bogl-bterm busybox-static cryptsetup-bin dctrl-tools dpkg-repack gdal-data gir1.2-gst-plugins-bad-1.0 gir1.2-timezonemap-1.0 gir1.2-xkl-1.0 grub-common
  libaec0 libarmadillo9 libarpack2 libavcodec-dev libavformat-dev libavresample-dev libavresample4 libavutil-dev libcfitsio8 libcharls2 libdap25 libdapclient6v5 libdc1394-22-dev
  libdebian-installer4 libepsilon1 libexif-dev libfreexl1 libfyba0 libgdal26 libgdcm-dev libgdcm3.0 libgeos-3.8.0 libgeos-c1v5 libgeotiff5 libgl2ps1.4 libgphoto2-dev libhdf4-0-alt
  libhdf5-103 libhdf5-openmpi-103 libilmbase-dev libjbig-dev libjpeg-dev libjpeg-turbo8-dev libjpeg8-dev libkmlbase1 libkmldom1 libkmlengine1 liblept5 liblzma-dev libminizip1
  libnetcdf-c++4 libnetcdf15 libodbc1 libogdi4.1 libopenexr-dev libpng-dev libpq5 libproj15 libqhull7 libraw1394-dev libsocket++1 libspatialite7 libsuperlu5 libswresample-dev
  libswscale-dev libsz2 libtesseract4 libtiff-dev libtiffxx5 libtimezonemap-data libtimezonemap1 liburiparser1 libvtk6.3 libxerces-c3.2 odbcinst odbcinst1debian2 os-prober proj-data
  python3-icu python3-pam rdate tasksel tasksel-data
Use 'sudo apt autoremove' to remove them.
The following packages will be DOWNGRADED:
  libcurl4
0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 35 not upgraded.
Need to get 185 kB of archives.
After this operation, 82.9 kB disk space will be freed.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-updates/main arm64 libcurl4 arm64 7.58.0-2ubuntu3.24 [185 kB]
Fetched 185 kB in 1s (307 kB/s)  
debconf: delaying package configuration, since apt-utils is not installed
dpkg: warning: downgrading libcurl4:arm64 from 7.68.0-1ubuntu2.14 to 7.58.0-2ubuntu3.24
(Reading database ... 162060 files and directories currently installed.)
Preparing to unpack .../libcurl4_7.58.0-2ubuntu3.24_arm64.deb ...
Unpacking libcurl4:arm64 (7.58.0-2ubuntu3.24) over (7.68.0-1ubuntu2.14) ...
Setting up libcurl4:arm64 (7.58.0-2ubuntu3.24) ...
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...

安装成功,接下来再执行如下命令:

sudo apt-get install libcurl4-openssl-dev

出现如下提示:

nvidia@ubuntu:~/git/deepbox$ sudo apt-get install libcurl4-openssl-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  apt-clone archdetect-deb bogl-bterm busybox-static cryptsetup-bin dctrl-tools dpkg-repack gdal-data gir1.2-gst-plugins-bad-1.0 gir1.2-timezonemap-1.0 gir1.2-xkl-1.0 grub-common
  libaec0 libarmadillo9 libarpack2 libavcodec-dev libavformat-dev libavresample-dev libavresample4 libavutil-dev libcfitsio8 libcharls2 libdap25 libdapclient6v5 libdc1394-22-dev
  libdebian-installer4 libepsilon1 libexif-dev libfreexl1 libfyba0 libgdal26 libgdcm-dev libgdcm3.0 libgeos-3.8.0 libgeos-c1v5 libgeotiff5 libgl2ps1.4 libgphoto2-dev libhdf4-0-alt
  libhdf5-103 libhdf5-openmpi-103 libilmbase-dev libjbig-dev libjpeg-dev libjpeg-turbo8-dev libjpeg8-dev libkmlbase1 libkmldom1 libkmlengine1 liblept5 liblzma-dev libminizip1
  libnetcdf-c++4 libnetcdf15 libodbc1 libogdi4.1 libopenexr-dev libpng-dev libpq5 libproj15 libqhull7 libraw1394-dev libsocket++1 libspatialite7 libsuperlu5 libswresample-dev
  libswscale-dev libsz2 libtesseract4 libtiff-dev libtiffxx5 libtimezonemap-data libtimezonemap1 liburiparser1 libvtk6.3 libxerces-c3.2 odbcinst odbcinst1debian2 os-prober proj-data
  python3-icu python3-pam rdate tasksel tasksel-data
Use 'sudo apt autoremove' to remove them.
Suggested packages:
  libcurl4-doc libidn11-dev libkrb5-dev libldap2-dev librtmp-dev libssh2-1-dev libssl-dev
The following NEW packages will be installed:
  libcurl4-openssl-dev
0 upgraded, 1 newly installed, 0 to remove and 35 not upgraded.
Need to get 276 kB of archives.
After this operation, 1,339 kB of additional disk space will be used.
Get:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-updates/main arm64 libcurl4-openssl-dev arm64 7.58.0-2ubuntu3.24 [276 kB]
Fetched 276 kB in 1s (551 kB/s)              
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libcurl4-openssl-dev:arm64.
(Reading database ... 162060 files and directories currently installed.)
Preparing to unpack .../libcurl4-openssl-dev_7.58.0-2ubuntu3.24_arm64.deb ...
Unpacking libcurl4-openssl-dev:arm64 (7.58.0-2ubuntu3.24) ...
Setting up libcurl4-openssl-dev:arm64 (7.58.0-2ubuntu3.24) ...
Processing triggers for man-db (2.9.1-1) ...

欧耶,安装成功,记下来这个办法,希望下次遇到这个问题时能找到这篇文章,直接复制拷贝解决。

GitHub 加速计划 / ope / openssl
25.13 K
9.99 K
下载
传输层安全性/安全套接层及其加密库
最近提交(Master分支:1 个月前 )
fd39d1c8 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/25095) 3 个月前
ae87c488 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/25095) 3 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐