Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

configure fails with No package 'gtk+-2.0' found (or glib-2.0, gthread-2.0)

ErrorNo package 'gtk+-2.0' found

Short answer

pkg-config finds a library only through its .pc file, which ships in the library's development package. Install libgtk2.0-dev, which pulls in libglib2.0-dev and pkg-config, then confirm with pkg-config --exists. If the library sits in a custom prefix, add that prefix's pkgconfig folder to PKG_CONFIG_PATH.

  • Applies to pkg-config, GTK 2.24, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Ask pkg-config directly. A non-zero exit status means it cannot find the module.

    pkg-config --exists gtk+-2.0; echo "exit: $?"
    pkg-config --modversion glib-2.0 gthread-2.0
  2. 2Match what you see, then jump to its fix

    1. 1pkg-config --exists exits non-zero for the module named in the errorThe development package is not installedFix
    2. 2pkg-config --list-all does not show the module, though you built or unpacked the library yourselfThe library is installed in a prefix pkg-config does not searchFix

What does the error look like?

  • No package 'gtk+-2.0' found
  • Package glib-2.0 was not found in the pkg-config search path.

Cause 1 of 2

The development package is not installed

1Check

Only the -dev package carries the .pc file and headers. Check whether it is installed.

dpkg -l libgtk2.0-dev libglib2.0-dev

2Fix

Install the GTK 2 development package. On Ubuntu 24.04 it is in the universe section and depends on libglib2.0-dev and pkg-config.

sudo apt install libgtk2.0-dev

3Verify

Ask pkg-config again, then rerun configure.

pkg-config --modversion gtk+-2.0
./configure

Confirmed by packages.ubuntu.com

Did this fix it?

Cause 2 of 2

The library is installed in a prefix pkg-config does not search

1Check

pkg-config looks in compiled-in default directories plus PKG_CONFIG_PATH. List what it can see.

echo "$PKG_CONFIG_PATH"
pkg-config --list-all | grep -i gtk

2Fix

Put the folder that holds the .pc file at the front of PKG_CONFIG_PATH for this shell, then run configure.

export PKG_CONFIG_PATH=/opt/gtk2/lib/pkgconfig:$PKG_CONFIG_PATH
./configure

3Verify

pkg-config now reports the module.

pkg-config --exists gtk+-2.0 && echo found

Confirmed by manpages.debian.org

Did this fix it?

How do I stop it coming back?

  • Read the project's build requirements and install every -dev package in one apt command.
  • Prefer distribution packages to hand-built libraries so pkg-config finds them without extra variables.
  • Check that the project still needs GTK 2; many programs now ship a GTK 3 build option.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Related fixes

Servers

dnf cannot install MySQL on Amazon Linux 2023

dnf cannot find a mysql-server package on Amazon Linux 2023

Amazon Linux 2023 documents MariaDB, not MySQL, as its database server, with packages named mariadb105 and mariadb105-server.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.