Building on Linux: pkg-config doesn't find GTK

Archive of historical development discussions
Discussions / Development has moved to GitHub
Forum rules
*******************************
Please be aware we are now using GitHub for issue tracking and feature requests.
- This section of the forum is now closed to new topics.

*******************************
Post Reply
j1elo
Posts: 1
Joined: Thu Oct 23, 2014 12:18 pm

Building on Linux: pkg-config doesn't find GTK

Post by j1elo »

Hi there!
I could use a bit of help trying to compile Handbrake with a Gtk installation in a non-standard folder.

I compiled all of Gtk+-3.12 and its dependencies into /opt/gtk+-3.12.2/, then set up several environment variables to their corresponding paths:
  • PATH to <gtk>/bin/ (for access to binary files)
    LD_LIBRARY_PATH to <gtk>/lib/ (for access to library files)
    PKG_CONFIG_PATH to <gtk>/lib/pkgconfig/ (for access to pkg-config (*.pc) files)
    XDG_DATA_DIRS to <gtk>/share/ (for access to gobject-introspection (*.gir) files)
Now the problem is that the pkg-config command doesn't seem to catch the proper path to the Gtk library, and the build fails with this message:
configure: error: Package requirements (gtk+-3.0 gthread-2.0 gio-2.0 libnotify dbus-glib-1 gmodule-2.0 gudev-1.0) were not met:

No package 'gtk+-3.0' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Seen in the file <handbrake>/build/gtk/config.log is this:
configure:18460: $PKG_CONFIG --exists --print-errors "$GHB_PACKAGES"
Package gtk+-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk+-3.0' found
configure:18463: $? = 1
configure:18477: result: no
No package 'gtk+-3.0' found
However, if I repeat that command inthe same shell, it seems to be ok:

Code: Select all

$ pkg-config --exists --print-errors "gtk+-3.0"
$
It prints nothing (which means success finding the package)

And, indeed:

Code: Select all

$ pkg-config --cflags --libs "gtk+-3.0"
-pthread -I/opt/gtk+-3.12.2/gtk+-3.12.2/include/gtk-3.0 -I/opt/gtk+-3.12.2/at-spi2-atk-2.12.1/include/at-spi2-atk/2.0 -I/opt/gtk+-3.12.2/atk-2.12.0/include/atk-1.0 -I/opt/gtk+-3.12.2/pango-1.36.8/include/pango-1.0 -I/opt/gtk+-3.12.2/fontconfig-2.11.1/include -I/usr/include/freetype2 -I/opt/gtk+-3.12.2/harfbuzz-0.9.35/include/harfbuzz -I/opt/gtk+-3.12.2/cairo-1.14.0/include/cairo -I/opt/gtk+-3.12.2/gdk-pixbuf-2.30.8/include/gdk-pixbuf-2.0 -I/opt/gtk+-3.12.2/glib-2.40.2/include/gio-unix-2.0/ -I/opt/gtk+-3.12.2/glib-2.40.2/include/glib-2.0 -I/opt/gtk+-3.12.2/glib-2.40.2/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng12  -L/opt/gtk+-3.12.2/gtk+-3.12.2/lib -L/opt/gtk+-3.12.2/atk-2.12.0/lib -L/opt/gtk+-3.12.2/pango-1.36.8/lib -L/opt/gtk+-3.12.2/cairo-1.14.0/lib -L/opt/gtk+-3.12.2/gdk-pixbuf-2.30.8/lib -L/opt/gtk+-3.12.2/glib-2.40.2/lib -lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0
No other Gtk development packages fromthe system are interfering in the process:

Code: Select all

$ dpkg --get-selections | grep -v deinstall | grep gtk | grep dev
$
So what could be possibly happening here? Maybe the build scripts are looking for pkg-config packages in a hardcoded path?
Post Reply