3

I'm trying to compile code that uses glib.h. I found in internet that package libglib2.0-dev contains it. But I can't install it.

Here's my console output:

> sudo apt-get install libglib2.0-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:
 libglib2.0-dev : Depends: libglib2.0-0 (= 2.48.0-1ubuntu4) but 2.48.2-0ubuntu1 is to be installed
                  Depends: libglib2.0-bin (= 2.48.0-1ubuntu4)
E: Unable to correct problems, you have held broken packages.

And from aptitude:

> sudo aptitude install libglib2.0-dev
The following NEW packages will be installed:
  libelf1:i386{a} libffi6:i386{a} libglib2.0-0:i386{ab} 
  libglib2.0-bin:i386{ab} libglib2.0-dev{b} libpcre3:i386{a} 
  libpcre3-dev{a} libpcre32-3{a} libpcrecpp0v5{a} libselinux1:i386{a} 
  zlib1g:i386{a} 
0 packages upgraded, 11 newly installed, 0 to remove and 1 not upgraded.
Need to get 3680 kB of archives. After unpacking 21,9 MB will be used.
The following packages have unmet dependencies:
 libglib2.0-bin : Conflicts: libglib2.0-bin:i386 but 2.48.0-1ubuntu4 is to be installed.
 libglib2.0-bin:i386 : Conflicts: libglib2.0-bin but 2.48.2-0ubuntu1 is installed.
 libglib2.0-dev : Depends: libglib2.0-0 (= 2.48.0-1ubuntu4) but 2.48.2-0ubuntu1 is installed.
 libglib2.0-0 : Breaks: libglib2.0-0:i386 (!= 2.48.2-0ubuntu1) but 2.48.0-1ubuntu4 is to be installed.
 libglib2.0-0:i386 : Breaks: libglib2.0-0 (!= 2.48.0-1ubuntu4) but 2.48.2-0ubuntu1 is installed.
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     libglib2.0-0:i386 [Not Installed]                  
2)     libglib2.0-bin:i386 [Not Installed]                
3)     libglib2.0-dev [Not Installed]                     



Accept this solution? [Y/n/q/?] 

When I type 'y' it does nothing. When I select 'n' it proposes me to uninstall ~1000 packages.

> apt policy libglib2.0-dev libglib2.0-0 libglib2.0-bin
libglib2.0-dev:
  Installed: (none)
  Candidate: 2.48.0-1ubuntu4
  Version table:
     2.48.0-1ubuntu4 500
        500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
libglib2.0-0:
  Installed: 2.48.2-0ubuntu1
  Candidate: 2.48.2-0ubuntu1
  Version table:
 *** 2.48.2-0ubuntu1 100
        100 /var/lib/dpkg/status
     2.48.0-1ubuntu4 500
        500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
libglib2.0-bin:
  Installed: 2.48.2-0ubuntu1
  Candidate: 2.48.2-0ubuntu1
  Version table:
 *** 2.48.2-0ubuntu1 100
        100 /var/lib/dpkg/status
     2.48.0-1ubuntu4 500
        500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages

Apt update output:

> sudo apt update                
Hit:1 http://pl.archive.ubuntu.com/ubuntu xenial InRelease
Hit:2 http://pl.archive.ubuntu.com/ubuntu xenial-updates InRelease             
Ign:3 http://dl.google.com/linux/chrome/deb stable InRelease                   
Hit:4 http://pl.archive.ubuntu.com/ubuntu xenial-backports InRelease           
Hit:5 http://archive.ubuntu.com/ubuntu xenial InRelease                        
Hit:6 http://ppa.launchpad.net/embrosyn/cinnamon/ubuntu xenial InRelease       
Get:7 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]     
Hit:8 http://dl.google.com/linux/chrome/deb stable Release                     
Hit:9 http://ppa.launchpad.net/nathan-renniewaldock/flux/ubuntu xenial InRelease
Hit:10 http://ppa.launchpad.net/noobslab/themes/ubuntu xenial InRelease        
Hit:11 http://ppa.launchpad.net/webupd8team/sublime-text-3/ubuntu xenial InRelease
Fetched 102 kB in 0s (129 kB/s)                   
Reading package lists... Done
Building dependency tree       
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.

> sudo apt list --upgradable     
Listing... Done
qemu/xenial-updates,xenial-security 1:2.5+dfsg-5ubuntu10.14 amd64 [upgradable from: 1:2.5+dfsg-5ubuntu10.10]
N: There are 2 additional versions. Please use the '-a' switch to see them.

I don't know how to get this package.

  • Can you please include the output of apt policy libglib2.0-dev libglib2.0-0 libglib2.0-bin ? – Byte Commander Jun 1 '17 at 20:13
  • Do you try sudo apt update before ? whats the output of this command? – Ali Razmdideh Jun 1 '17 at 20:24
  • @ByteCommander Done. – Hubert Banaszewski Jun 1 '17 at 20:26
  • @ali76 I've done it. I will add output to question. – Hubert Banaszewski Jun 1 '17 at 20:28
  • aptitude why libglib2.0-bin:i386 might be helpful as well – steeldriver Jun 1 '17 at 20:34
7

As the first step you should remove 2.48.2-0ubuntu1 version of libglib2.0-0 with this command:

sudo dpkg -r --force-all libglib2.0-0

After that you should install libglib2.0-0 and fix broken packages:

sudo apt update
sudo apt install -f
sudo apt install libglib2.0-0 

Finally you can install:

sudo apt install libglib2.0-dev
| improve this answer | |
  • 1
    It would be better to downgrade those packages directly instead of removing them by force only to reinstall them right away. See Byte Commander's answer. – David Foerster Jun 1 '17 at 21:13
  • Can I get a second opinion on @DavidFoerster 's comment? – Nathan Apr 23 '18 at 1:28
  • @frank: Well, there's at least the opinion of the author who wrote the aforementioned answer. It's more like mine is the second opinion here. Additionally, somebody voted for my comment. – David Foerster Apr 23 '18 at 9:21
1

From wherever (probably a PPA you had installed at some time), you have cached package files for libglib2.0-0 and libglib2.0-bin saved locally. They are a newer version than the ones from the current official repositories and incompatible with those.

To empty your local package cache and prevent these cached packages from getting installed, you can optionally (not absolutely necessary and maybe not as effective as desired) run

sudo apt clean

After that or as only step you can just tell apt the versions to install manually:

sudo apt install libglib2.0-dev libglib2.0-0=2.48.0-1ubuntu4 libglib2.0-bin=2.48.0-1ubuntu4
| improve this answer | |
  • What if I'm trying to install libglib2.56? Do I have to do it directly from here or is sudo apt install libglib2.0-dev sufficient? – Nathan Apr 23 '18 at 1:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.