Unable to insall libgtk2.0-dev on ubuntu 12.04

Solution 1:

Try installing all of them at the same time, like this:

sudo apt-get install libgtk2.0-dev libpango1-dev libcairo2-dev libfontconfig1-dev

Solution 2:

Sometimes the package dependencies are related to packages out of x86_64 architecture. Try these following steps:

  1. sudo dpkg --add-architecture i386
  2. sudo apt-get update
  3. sudo apt-get install libgtk2.0-dev

I hope to help you.

Solution 3:

Unable to correct problems, you have held broken packages.

That line from the output you received (when trying to install libgtk2.0-dev) seems to indicate you need to fix broken and missing packages.

Try this:

sudo apt-get update && sudo apt-get upgrade --fix-missing --fix-broken

Then, assuming that was successful, you should be able to run the install command for libgtk2.0-dev without any problems

sudo apt-get install libgtk2.0-dev

If it still doesn't work, try looking for what packages are being held back:

dpkg --get-selections | grep hold

If that command gives you any output (should be package names of whatever packages are being held) try this:

sudo apt-get install <packagename>

Then try to install libgtk2.0-dev again.

If it still fails, perhaps consider doing a dist-upgrade

sudo apt-get dist-upgrade

I hope this helps!