1

I am trying to run the first sample code on this site. Unfortunately I got the following error message:

Package gobject-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gobject-2.0.pc'
to the PKG_CONFIG_PATH environment variable

So I used locate gobject-2.0.pc to find its location and added

export PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig:PKG_CONFIG_PATH"`

at the end of my ~/.bashrc. Now I get the following error message when I try to compile the vala code:

/path/to/foo.vala.c:9:21: fatal error: gtk/gtk.h: No such file or directory
compilation terminated.

I found a gtk.h in /usr/include/gtk-3.0/gtk, but the compiler can't find it apparently. I also noticed that

$ pkg-config --cflags gtk+-3.0

yields

Package xproto was not found in the pkg-config search path.
Perhaps you should add the directory containing `xproto.pc'
to the PKG_CONFIG_PATH environment variable
Package 'xproto', required by 'xau', not found

although xproto.pc is in /usr/share/pkgconfig and the pkg-config man-page lists this as one of standard search paths of pkg-config.

Edit: On the other hand

$ pkg-config --libs gtk+-3.0

yields

-L/usr/lib/x86_64-linux-gnu -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0

which looks as one would expect. /Edit

Can anyone help me with this?

Cheers

  • Do you have the libgtk-3-dev package installed? – lemonslice Jan 24 '17 at 14:59
  • Yes. I think I've checked five time by now ^^ – FloodLuszt Jan 24 '17 at 15:26
  • Sorry, do you have elementary-sdk installed as well? – lemonslice Jan 24 '17 at 16:17
  • 1
    Thanks! I didn't.. But it still does not work. I just saw that pkg-config --libs gtk+-3.0 prints -L/usr/lib/x86_64-linux-gnu -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 so that look okay. I will add that to the original question. – FloodLuszt Jan 24 '17 at 16:41
  • i am stuck at the same result – longbow Jun 2 '17 at 20:41
1

Just had the same issue on elementary OS Hera. I've fixed it by adding this line to my .bashrc:

export PKG_CONFIG_PATH="/usr/share/pkgconfig:/usr/lib/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.