Sometimes includes in CFLAGS are missing

On compiling OS products with pkg-config there is some times the problem that some include paths are missing. Why does that happen?

asked: 2012-03-30 by: cgrzemba

Dagobert answers:

The reason is that configure use pkg-config --cflags to get the include paths from pc file of packages which it depends on. configure reports if the dependend package is not installed: no problem.

But a problem raise if the pc file contains Requires and Requires.private keys like libgnome-2.0.pc. Then the first test if libgnome-2.0 package is installed will be true, but the command

pkg-config --cflags libgnome-2.0

will fail if some packages of Requires are missing. Unfortunatly configure will continue without report a problem and lets the CFLAGS variable empty!

With the following script it is possible to see if there are such problems possible

for p in `grep PKG_CHECK_MODULES work/build-isa*/*/ | cut -d, -f2 | awk '{ print $1 }' | sed -e 's/\[//' -e 's/)//' | sort | uniq` ; { 
    pkg-config --cflags $p > /dev/null || echo ">>> problem with package $p";