安装 libcairo2-dev

安装 libcairo2-dev

libcairo2-dev我正在尝试在 Ubuntu 18.04.2 LTS Bionic 中 安装。
我跑:

    $ sudo apt-get install libcairo2-de

    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:
     libcairo2-dev : Depends: libx11-dev but it is not going to be installed
                     Depends: libxrender-dev (>= 0.6) but it is not going to be installed
                     Depends: libxext-dev but it is not going to be installed
                     Depends: libxcb1-dev (>= 1.6) but it is not going to be installed
                     Depends: libxcb-render0-dev (>= 1.6) but it is not going to be installed
                     Depends: libxcb-shm0-dev but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.

然后我尝试

    $ sudo apt-get autoclean

    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    $ sudo apt-get -f install

    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
    $ sudo apt-get -u dist-upgrade

    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Calculating upgrade... Done
    0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.

但什么都没起作用,
我的来源列表:

    cat /etc/apt/sources.list
    deb http://archive.ubuntu.com/ubuntu bionic main universe restricted multiverse
    deb-src http://archive.ubuntu.com/ubuntu bionic main universe restricted multiverse #Added by software-properties
    deb http://security.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse
    deb http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse

然后我尝试了什么guivercStrabagISS_Krall建议

sudo apt-get update
Hit:1 http://ppa.launchpad.net/klaus-vormweg/awesome/ubuntu bionic InRelease              
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease                                   
Hit:3 http://security.ubuntu.com/ubuntu bionic-security InRelease   
Ign:4 http://dl.google.com/linux/chrome/deb stable InRelease             
Hit:5 http://archive.ubuntu.com/ubuntu bionic-updates InRelease         
Hit:6 http://dl.google.com/linux/chrome/deb stable Release
Reading package lists... Done

然后 ,

sudo apt full-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.

进而 ,

sudo apt-get install libcairo2-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:
 libcairo2-dev : Depends: libx11-dev but it is not going to be installed
                 Depends: libxrender-dev (>= 0.6) but it is not going to be installed
                 Depends: libxext-dev but it is not going to be installed
                 Depends: libxcb1-dev (>= 1.6) but it is not going to be installed
                 Depends: libxcb-render0-dev (>= 1.6) but it is not going to be installed
                 Depends: libxcb-shm0-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

事实上,我会检查每个依赖项的版本与最新版本的对比。

$ apt-cache showpkg libx11-dev
Package: libx11-dev
Versions: 
2:1.6.4-3ubuntu0.2 (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic-updates_main_binary-amd64_Packages)


$ apt-cache showpkg libxrender-dev
Package: libxrender-dev
Versions: 
1:0.9.10-1 (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_main_binary-amd64_Packages)

N0rbert 建议重新创建存储库列表,但当我运行 sudo apt-get update 时,没有任何存储库无法获取,见上文。但无论如何,我尝试按照建议重新创建存储库列表如何恢复默认存储库?但没有作用。

答案1

安装时我也遇到了同样的问题libcairo2-dev,我发现其中一个依赖项与它所需的版本不匹配-

libxau-dev : Depends: libxau6 (= 1:1.0.8-1) but 1:1.0.8-1ubuntu1 is to be installed

因此,我尝试安装一个特定版本——

$ sudo apt install libaux6=1:1.0.8-1

其中我收到了一些软件包删除和一个降级请求——

The following packages were automatically installed and are no longer required:
  libapparmor1:i386 libasn1-8-heimdal:i386 libasound2:i386 libasyncns0:i386 libatk1.0-0:i386 libatomic1:i386 libavahi-client3:i386
  libavahi-common-data:i386 libavahi-common3:i386 libbsd0:i386 libcap2:i386 libcapi20-3 libcapi20-3:i386 libcdparanoia0:i386 libcups2:i386
  libdatrie1:i386 libdbus-1-3:i386 libdrm-amdgpu1:i386 libdrm-intel1:i386 libdrm-nouveau2:i386 libdrm-radeon1:i386 libdrm2:i386 libedit2:i386
  libelf1:i386 libexif12:i386 libexpat1:i386 libffi6:i386 libflac8:i386 libfontconfig1:i386 libfreetype6:i386 libgl1-mesa-dri:i386
  libglapi-mesa:i386 libglib2.0-0:i386 libglvnd0:i386 libgmp10:i386 libgnutls30:i386 libgphoto2-port12:i386 libgraphite2-3:i386 libgsm1:i386
  libgssapi-krb5-2:i386 libgssapi3-heimdal:i386 libgstreamer-plugins-base1.0-0:i386 libgstreamer1.0-0:i386 libharfbuzz0b:i386
  libhcrypto4-heimdal:i386 libheimbase1-heimdal:i386 libheimntlm0-heimdal:i386 libhogweed4:i386 libhx509-5-heimdal:i386 libicu60:i386
  libidn2-0:i386 libieee1284-3:i386 libjack-jackd2-0:i386 libjbig0:i386 libjpeg-turbo8:i386 libjpeg8:i386 libk5crypto3:i386 libkeyutils1:i386
  libkrb5-26-heimdal:i386 libkrb5-3:i386 libkrb5support0:i386 liblcms2-2:i386 libldap-2.4-2:i386 libllvm10:i386 libltdl7:i386 libmpg123-0:i386
  libnettle6:i386 libogg0:i386 libopenal1:i386 libopus0:i386 liborc-0.4-0:i386 libosmesa6:i386 libp11-kit0:i386 libpango-1.0-0:i386
  libpangoft2-1.0-0:i386 libpcap0.8:i386 libpciaccess0:i386 libpixman-1-0:i386 libpng16-16:i386 libroken18-heimdal:i386 libsamplerate0:i386
  libsasl2-2:i386 libsasl2-modules:i386 libsasl2-modules-db:i386 libsensors4:i386 libsndfile1:i386 libsndio6.1:i386 libspeexdsp1:i386
  libsqlite3-0:i386 libssl1.1:i386 libstdc++6:i386 libsystemd0:i386 libtasn1-6:i386 libthai0:i386 libtiff5:i386 libudev1:i386 libunistring2:i386
  libusb-1.0-0:i386 libv4l-0:i386 libv4lconvert0:i386 libvisual-0.4-0:i386 libvorbis0a:i386 libvorbisenc2:i386 libwayland-client0:i386
  libwayland-cursor0:i386 libwayland-egl1:i386 libwebp6:i386 libwind0-heimdal:i386 libwrap0:i386 libx11-xcb1:i386 libxdmcp6:i386
  libxkbcommon0:i386 libxml2:i386 libxshmfence1:i386 libxslt1.1:i386 ocl-icd-libopencl1:i386 wine-stable-amd64
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  adobereader-enu:i386 gstreamer1.0-plugins-base:i386 libasound2-plugins:i386 libcairo2:i386 libgd3:i386 libgdk-pixbuf2.0-0:i386 libgl1:i386
  libgl1-mesa-glx:i386 libglu1-mesa:i386 libglx-mesa0:i386 libglx0:i386 libgphoto2-6:i386 libgtk2.0-0:i386 libpangocairo-1.0-0:i386
  libpulse0:i386 libsane1:i386 libsdl2-2.0-0:i386 libtheora0:i386 libx11-6:i386 libxau6:i386 libxcb-dri2-0:i386 libxcb-dri3-0:i386
  libxcb-glx0:i386 libxcb-present0:i386 libxcb-render0:i386 libxcb-shm0:i386 libxcb-sync1:i386 libxcb1:i386 libxcomposite1:i386 libxcursor1:i386
  libxdamage1:i386 libxext6:i386 libxfixes3:i386 libxi6:i386 libxinerama1:i386 libxpm4:i386 libxrandr2:i386 libxrender1:i386 libxss1:i386
  libxxf86vm1:i386 steam:i386 wine-stable wine-stable-i386:i386 winehq-stable
The following packages will be DOWNGRADED:
  libxau6
0 upgraded, 0 newly installed, 1 downgraded, 44 to remove and 1 not upgraded.
Need to get 7,513 kB of archives.
After this operation, 29.0 MB of additional disk space will be used.
Do you want to continue? [Y/n]

我选择了“Y”,然后——

$ sudo apt install libcairo2-dev

...和瞧……似乎固定的问题 !

答案2

您需要先更新系统。请尝试:

sudo apt update
sudo apt full-upgrade
sudo apt install libcairo2-dev

相关内容