pkgconfig and gtk+ issue

Hello,

I’m trying to compile kernelshark on a openSUSE 11.4 (64 bit) machine.
The problem is explained best in the shell:

trace-cmd> make gui
Package gtk±2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk±2.0.pc’
to the PKG_CONFIG_PATH environment variable
No package ‘gtk±2.0’ found

trace-cmd> ls /usr/lib64/pkgconfig/gtk*
/usr/lib64/pkgconfig/gtk±2.0.pc /usr/lib64/pkgconfig/gtkmm-2.4.pc /usr/lib64/pkgconfig/gtk±x11-2.0.pc
/usr/lib64/pkgconfig/gtk-engines-2.pc /usr/lib64/pkgconfig/gtk±unix-print-2.0.pc

trace-cmd> setenv PKG_CONFIG_PATH /usr/lib64/pkgconfig
trace-cmd> make gui
Package gtk±2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk±2.0.pc’
to the PKG_CONFIG_PATH environment variable
No package ‘gtk±2.0’ found

trace-cmd> rpm -q libgtk-2_0-0 gtk2-devel
libgtk-2_0-0-2.22.1-13.15.1.x86_64
gtk2-devel-2.22.1-13.15.1.x86_64

Why doesn’t pkgconfig find the library? What am I missing here?

Andreas

sudo zypper in -C ‘pkgconfig(gtk±2.0)’

On 2012-04-19 10:26, AKS42 wrote:

> Why doesn’t pkgconfig find the library? What am I missing here?

Dunno, but:

> Perhaps you should add the directory containing `gtk±2.0.pc’


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Thanks for your reply!

This is what the “setenv” command was for. Is the environment being ignored?

And, why is it necessary in the first place? I would have expected pkgconfig to have that directory already. /usr/lib64/pkgconfig seems to be the place where all the .pc files reside, so why doesn’t it look there first?

Can you list the module with pkg-config --list-all?
Like this example


martinh@ganymed:~> pkg-config --list-all | grep gtk
gtk+-2.0                       GTK+ - GTK+ Graphical UI Library (x11 target)
gtk-sharp-2.0                  Gtk - Gtk
gtk+-unix-print-2.0            GTK+ - GTK+ Unix print support
gtk+-x11-2.0                   GTK+ - GTK+ Graphical UI Library (x11 target)
gtk-dotnet-2.0                 Gtk.DotNet - .NET Extensions for Gtk


PC: oS 11.4 x86_64 | Intel Core i7-2600@3.40GHz | 16GB | KDE 4.8.2 |
GeForce GT 420
Eee PC 1201n: oS 12.1 x86_64 | Intel Atom 330@1.60GHz | 3GB | KDE 4.8.2
| nVidia ION
eCAFE 800: oS 12.1 i586 | AMD Geode LX 800@500MHz | 512MB | KDE 3.5.10 |
xf86-video-geode


trace-cmd> pkg-config --list-all 
libssl                OpenSSL - Secure Sockets Layer and cryptography libraries
gmodule-export-2.0    GModule - Dynamic module loader for GLib
libpcre               libpcre - PCRE - Perl compatible regular expressions C library with 8 bit character support
libdaemon             libdaemon - a lightweight C library that eases the writing of UNIX daemons
libpcrecpp            libpcrecpp - PCRECPP - C++ wrapper for PCRE
gmodule-2.0           GModule - Dynamic module loader for GLib
gio-unix-2.0          GIO unix specific APIs - unix specific headers for glib I/O library
openssl               OpenSSL - Secure Sockets Layer and cryptography libraries and tools
usbutils              usbutils - USB device database
libffi                libffi - Library supporting Foreign Function Interfaces
glib-2.0              GLib - C Utility Library
zlib                  zlib - zlib compression library
libpcreposix          libpcreposix - PCREPosix - Posix compatible interface to libpcre
gthread-2.0           GThread - Thread support for GLib
gobject-2.0           GObject - GLib Type, Object, Parameter and Signal Library
uuid                  uuid - Universally unique id library
gmodule-no-export-2.0 GModule - Dynamic module loader for GLib
libcrypto             OpenSSL-libcrypto - OpenSSL cryptography library
gio-2.0               GIO - glib I/O library
libcurl               libcurl - Library to transfer files with ftp, http, etc.
libusb                libusb - USB access library
libusb-1.0            libusb-1.0 - C API for USB device access from Linux userspace
blkid                 blkid - Block device id library
mount                 mount - mount library

No gtk in there…

Am 19.04.2012 13:16, schrieb AKS42:
> No gtk in there…
>
That is strange you have the gtk2-devel and if I am not mislead this is
the one which installs the correct pc file, so it should list gtk-2.0
here (it does it for me both on 11.4 and 12.1).

Another question, why did you use


setenv PKG_CONFIG_PATH /usr/lib64/pkgconfig

are you not using the bash shell? If not what else, because it is a
c-shell command.


PC: oS 11.4 x86_64 | Intel Core i7-2600@3.40GHz | 16GB | KDE 4.8.2 |
GeForce GT 420
Eee PC 1201n: oS 12.1 x86_64 | Intel Atom 330@1.60GHz | 3GB | KDE 4.8.2
| nVidia ION
eCAFE 800: oS 12.1 i586 | AMD Geode LX 800@500MHz | 512MB | KDE 3.5.10 |
xf86-video-geode

Thank you for your answers!

Yes, I’m a tcsh user.

Should I try reinstalling the gtk packages to trigger some pre/postinstall scripts (if there are any)?
Or is there a way to tell pkg-config to rescan the .pc files?

Am 19.04.2012 13:46, schrieb AKS42:
> Yes, I’m a tcsh user.
Just to narrow down the problem, can you try the make command from a
bash to see if there is the same problem or not?

What command is exactly executed in the makefile which does throw this
error message?

>
> Should I try reinstalling the gtk packages to trigger some
> pre/postinstall scripts (if there are any)?
Difficult to say, since it does not do any harm I would just try it.

> Or is there a way to tell pkg-config to rescan the .pc files?
>
That I do not know I cannot see an option for that.


PC: oS 11.4 x86_64 | Intel Core i7-2600@3.40GHz | 16GB | KDE 4.8.2 |
GeForce GT 420
Eee PC 1201n: oS 12.1 x86_64 | Intel Atom 330@1.60GHz | 3GB | KDE 4.8.2
| nVidia ION
eCAFE 800: oS 12.1 i586 | AMD Geode LX 800@500MHz | 512MB | KDE 3.5.10 |
xf86-video-geode

On 2012-04-19 13:46, AKS42 wrote:

> Yes, I’m a tcsh user.

Try creating a new user with bash as shell, and try there, to see if it is
an issue.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

I tried that but it had no effect.

“remake” is a bit more verbose:


trace-cmd> remake gui
Package gtk+-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk+-2.0' found
Package gtk+-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk+-2.0' found
Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libxml-2.0' found
  GUI COMPILE            trace-graph-main.o
/media/5-home/aschallenberg/tmp/3wm-arm/util/trace-cmd/trace-graph-main.c:22:21: fatal error: gtk/gtk.h: Datei oder Verzeichnis nicht gefunden
compilation terminated.
/media/5-home/aschallenberg/tmp/3wm-arm/util/trace-cmd/Makefile:460: *** [trace-graph-main.o] Fehler 1

#0  trace-graph-main.o at /media/5-home/aschallenberg/tmp/3wm-arm/util/trace-cmd/Makefile:460
#1  trace-graph at /media/5-home/aschallenberg/tmp/3wm-arm/util/trace-cmd/Makefile:360
#2  all_gui at /media/5-home/aschallenberg/tmp/3wm-arm/util/trace-cmd/Makefile:345
Command-line invocation:
        "remake -f /media/5-home/aschallenberg/tmp/3wm-arm/util/trace-cmd/Makefile BUILDGUI=1 all_gui"
Makefile:342: *** [gui] Fehler 2

#0  gui at /media/5-home/aschallenberg/tmp/3wm-arm/util/trace-cmd/Makefile:342
Command-line invocation:
        "remake gui"

But this failure in line 460 is certainly caused due to the pkg-config problem. If gtk+ devel is not found, the include path is not available and then such an error is the consequence. So line 460 is the symptom, not the root cause.

This did not help. I even tried reinstalling pkg-config itself.

Where is PKG_CONFIG_PATH defined in the system? If I grep for that variable, there are no hits in /etc.
Perhaps there is a mistake in the pkg-config configuration…

Yes, that makes a difference!
Now pkg-config --list-all | grep gtk gives me for that user:


gtk+-2.0                  GTK+ - GTK+ Graphical UI Library (x11 target)
gtk+-x11-2.0              GTK+ - GTK+ Graphical UI Library (x11 target)
gtk+-unix-print-2.0       GTK+ - GTK+ Unix print support
gtkmm-2.4                 gtkmm - C++ binding for the GTK+ toolkit

What the heck has my default shell to do with pkg-config?


trace-cmd> ls -l /bin/sh
lrwxrwxrwx 1 root root 4  2. Mär 2011  /bin/sh -> bash

On 2012-04-19 14:46, AKS42 wrote:
> Where is PKG_CONFIG_PATH defined in the system? If I grep for that
> variable, there are no hits in /etc.

/etc/profile.d/opt_gnome-compat.sh and .csh have some hits.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Both do not exist here…

Things are getting even more weird. I used strace to look over pkg-config’s shoulder and found that it was looking for some .pc files that were reachable via $PATH ! When I remove that directory (a cross-compile toolchain) from PATH it finds the .pc files on my system and “make gui” succeeds.

Why is pkg-config looking into the PATH to find the files and not into PKG_CONFIG_PATH !?!

Am 19.04.2012 15:26, schrieb AKS42:
>
> Things are getting even more weird. I used strace to look over
> pkg-config’s shoulder and found that it was looking for some .pc files
> that were reachable via $PATH ! When I remove that directory (a
> cross-compile toolchain) from PATH it finds the .pc files on my system
> and “make gui” succeeds.
>
> Why is pkg-config looking into the PATH to find the files and not into
> PKG_CONFIG_PATH !?!
>
>
You can ask pkg-config itself to show you where it searches


pkg-config --variable pc_path pkg-config

(it is described in the man page)


PC: oS 11.4 x86_64 | Intel Core i7-2600@3.40GHz | 16GB | KDE 4.8.2 |
GeForce GT 420
Eee PC 1201n: oS 12.1 x86_64 | Intel Atom 330@1.60GHz | 3GB | KDE 4.8.2
| nVidia ION
eCAFE 800: oS 12.1 i586 | AMD Geode LX 800@500MHz | 512MB | KDE 3.5.10 |
xf86-video-geode

On 2012-04-19 14:56, AKS42 wrote:
> What the heck has my default shell to do with pkg-config?

I have created a new user with tcl default shell (oS 11.4), and it works:


> cer@Telcontar:~> su - test
> Password:
> Telcontar /home/test> pkg-config --list-all | grep gtk
> gtk+-2.0                         GTK+ - GTK+ Graphical UI Library (x11 target)
> gtk-sharp-2.0                    Gtk - Gtk
> gtk-doc                          gtk-doc - API documentation generator
> gtk+-unix-print-2.0              GTK+ - GTK+ Unix print support
> gtk+-x11-2.0                     GTK+ - GTK+ Graphical UI Library (x11 target)
> gtk-dotnet-2.0                   Gtk.DotNet - .NET Extensions for Gtk
> libgnomeprint-2.2                libgnomeprint-2.2 - libgnomeprint - Printing library for gtk+ based applications
> libcanberra-gtk                  libcanberra-gtk - Gtk Event Sound API
> gtkhtml-sharp-3.14               Gtkhtml - Gtkhtml
> libgnomeprintui-2.2              libgnomeprintui-2.2 - libgnomeprint - Printing library for gtk+ based applications
> Telcontar /home/test>


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

The reason for the shell dependency was due to my .tcshrc having an statement expanding my $PATH to include the crosscompiler toolchain. When I called bash, the environment was kept, therefore I had the same problem. When I manually removed the crosscompiler toolchain from $PATH, pkg-config listed the gtk2 packages and I was able to build kernelshark.

Update: To be precise: I built using tcsh. The very same shell instance that failed before.

It is my belief that pkgconfig information is NOT being provided as it should for a while with opensuse (maybe since 11.4), thus these issues! it truly sucks when you’re trying to install something that uses pkgconfig to find library information. opensuse need more QA in this regard.

All pkgconfile meta info is located in /usr/lib/pkgconfig.

Care to explain how this was solved? I have the exact same problem when trying to compile.

“gtk±2.0 not found. Maybe you should include it to the path.”