Search code examples
linuxraspbianraspberry-pi2

Unable to install libgtk2.0-dev on Raspberry Pi 2


I am trying to install libgtk2.0-dev on my Raspberry Pi 2 running on latest raspbian. When I use the command sudo apt-get install libgtk2.0-dev, I get the following dependency errors:

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:
 libgtk2.0-dev : Depends: libpango1.0-dev (>= 1.20) but it is not going to be installed
                 Depends: libcairo2-dev (>= 1.6.4-6.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I tried fixing the broken packages using sudo apt-get install -f, sudo apt-get update, sudo apt-get upgrade and then sudo apt-get install libgtk2.0-dev. It still didn't work. I tried apt-get install on the dependencies and their dependencies, but the result is the same. The solutions in link1 and link2 did not help either.

My source.list contains:

deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi
deb http://archive.raspbian.org/raspbian jessie main contrib non-free rpi

Am I missing something in my source.list? How can I resolve this?


Solution

  • apt-cache policy libgtk2.0-dev libpango1.0-dev libcairo2-dev showed that the problem was with /etc/apt/sources.list.d/raspi.list.

    raspi.list contained deb http://archive.raspberrypi.org/debian/ wheezy main. Changed wheezy to jessie, ran apt-get update and then running apt-get install libgtk2.0-dev worked.