configure fails with No package 'gtk+-2.0' found (or glib-2.0, gthread-2.0)
No package 'gtk+-2.0' foundShort 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.
Fix it fast
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.02Match what you see, then jump to its fix
What does the error look like?
No package 'gtk+-2.0' foundPackage 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-dev2Fix
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-dev3Verify
Ask pkg-config again, then rerun configure.
pkg-config --modversion gtk+-2.0
./configureConfirmed by packages.ubuntu.com
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 gtk2Fix
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
./configure3Verify
pkg-config now reports the module.
pkg-config --exists gtk+-2.0 && echo foundConfirmed by manpages.debian.org
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 fixServers
Ansible hangs, then times out waiting for the sudo prompt
a playbook using become seems to hang
Ansible ran sudo on the target and never saw the answer it expected.
3 causes, each with a fixServers
Apache on Ubuntu returns 404 Not Found for my site
The requested URL was not found on this server.
On Ubuntu a 404 from Apache usually means the request maps to a path that has no file.
3 causes, each with a fixServers
Apache returns 504 Gateway Timeout when PHP takes too long
Quick requests work, slow ones end in a 504 after a fixed wait
A 504 from Apache means the backend did not answer within the proxy timeout.
2 causes, each with a fixServers
Apache logs SIGWINCH and exits on its own
the httpd container stops although nothing crashed
SIGWINCH is Apache's graceful-stop signal.
2 causes, each with a fixServers
Apache warns that a ${VAR} config variable is not defined
${VAR} left unchanged in the configuration, with a warning in the error log
Apache expands ${VAR} from Define or from the shell environment that exists when the server starts.
3 causes, each with a fix