3

I am trying to install libcairo2-dev in a Ubuntu 18.04.2 LTS Bionic.
I run :

    $ 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.

Then I try

    $ 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.

But nothing works,
My sources.list :

    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

Then I tried what guiverc and StrabagISS_Krall suggested

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

Then ,

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.

And then ,

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.

In fact, I check the version of each dependency they are there with the last version.

$ 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 suggested to recreate the repository list, but when I run sudo apt-get update none of the repositories fail to fetch, see above. But anyway I tried to recreate the repository list as suggest in How do I restore the default repositories? but did not work.

  • A package I looked is there (https://packages.ubuntu.com/search?suite=all&searchon=names&keywords=libx11-dev) however your system appears very out-of-date (your system should report 18.04.4). If you sudo apt update do you get expected results? I'd suggest doing that first, then letting your system upgrade fully, reboot and re-try (but sudo apt update is your first response, & read messages; lack of messages is a huge clue!) – guiverc Apr 21 '20 at 06:54
  • Ok. Thanks for you comment, but I tried sudo apt update and did not change the resutls. See my edited question with the results. – user1213013 Apr 21 '20 at 07:49
  • 1
  • Hey N0rbert, thanks for you suggestion. The repository file does not have any problem. But I tried to restored any way, it did not solve the problem. – user1213013 Apr 21 '20 at 12:07
  • @user1213013 I would recommend this https://askubuntu.com/q/140246/26246 but I hate it. It grew with years. Anyway, try full repository enabling then aptitude solutions. Any things else just record what you tried and report back on this question, link of answer and result. – user.dz Apr 21 '20 at 12:35
  • I'm getting a similar error on 16.04. – Simon Burton May 28 '20 at 17:51

2 Answers2

1

I faced the same problem too while installing libcairo2-dev, whence I found that one of the dependencies did not match the version it required--

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

So, I tried installing a specific version--

$ sudo apt install libaux6=1:1.0.8-1

wherein I got some package removal and one downgrading request--

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]

I opted for "Y", followed by--

$ sudo apt install libcairo2-dev

...and Voila... that seems to have fixed the problem !

Partha D.
  • 111
0

You need to update your system first. Please try:

sudo apt update
sudo apt full-upgrade
sudo apt install libcairo2-dev
BulletBob
  • 1,780
  • Thanks, I tried that but did not change the final results. See my edited question with the messages for each step – user1213013 Apr 21 '20 at 08:19