Get CFLAGS for a Package with pkg-config

As I tried to cross-compile an application that required glibconfig.h, I found a way to retrieve the CFLAGS for a given package.

Here’s the output for glib-2.0 and gtk-2.0 in qemu for overo:

pkg-config –cflags glib-2.0
-I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabi/glib-2.0/include

pkg-config –cflags gdk-2.0
-pthread -I/usr/include/gio-unix-2.0/ -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabi/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pixman-1

Finally, I found out that glibconfig,h was in /usr/lib/arm-linux-gnueabi/glib-2.0/include as this file is generated by configure and is platform dependent.

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK Pi 4C Plus
Notify of
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
Khadas VIM4 SBC