Bug 58847

Summary: PKG_CHECK_MODULES should error if a .pc dependency is not met
Product: pkg-config Reporter: Hashem Nasarat <hnasarat>
Component: srcAssignee: pkg-config
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: medium CC: hnasarat
Version: unspecified   
Hardware: Other   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Hashem Nasarat 2012-12-29 01:47:50 UTC
Running Debian Wheezy, pkg-config 0.26, autoconf 2.69.

The PKG_CHECK_MODULES autoconf macro currently does not issue an error and halt compilation when a dependency .pc file is not available.
For example, on my machine, for a particular project:

PKG_CHECK_MODULES([CAIRO], [cairo])

results in no error. However in the outputted Makefile, I see:
" PYCAIRO_CFLAGS =                                                               
  PYCAIRO_LIBS = -L/usr/lib/x86_64-linux-gnu -lcairo "

Curiously the CFLAGS was blank, resulting in a broken build. I finally debugged the issue from this:
"$ pkg-config --cflags pycairo
 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 "
and 
"$ pkg-config --libs pycairo
 -L/usr/lib/x86_64-linux-gnu -lcairo "
The solution was an incorrectly configured PKG_CONFIG_PATH variable.

I would expect that I would have gotten an error about missing xproto when I ran autoreconf, rather than having it produce a Makefile which would not compile.

Thanks!
Comment 1 Dan Nicholson 2012-12-29 13:45:58 UTC
This got fixed for pkg-config-0.27 in bug43149. I think if you try the latest release this should work correctly.

*** This bug has been marked as a duplicate of bug 43149 ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.