Bug 30937

Summary: Silently empty CFLAGS and LIBS when condition has restrictions
Product: pkg-config Reporter: Bastien Nocera <bugzilla>
Component: srcAssignee: Tollef Fog Heen <tfheen>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Bastien Nocera 2010-10-17 08:26:45 UTC
consider the following configure.ac snippet:
PKG_CHECK_MODULES(CHEESE, clutter-1.0 clutter-gst-1.0)

If both are present, you should end up with CHEESE_CFLAGS and CHEESE_LIBS being set. Except if an error occurs when running --libs:

$ pkg-config --exists --print-errors "clutter-1.0 clutter-gst-1.0" && echo success
success
$ pkg-config --libs --print-errors "clutter-1.0 clutter-gst-1.0" 
Package 'clutter-gst' requires 'clutter-1.0 < 1.3.0' but version of Clutter is 1.5.3

pkg-config should check for version compatibility during --exists, and error out appropriately, otherwise configure tests will silently succeed, and CFLAGS will be empty and cause compilation failures.
Comment 1 Bastien Nocera 2010-10-18 10:27:23 UTC
Had the same problem trying to build gnome-shell:

$ pkg-config --libs gobject-2.0 gio-2.0 gio-unix-2.0 dbus-glib-1 gtk+-3.0 mutter-plugins gjs-gi-1.0 libgnome-menu gconf-2.0 gdk-x11-3.0 clutter-x11-1.0 clutter-glx-1.0 libstartup-notification-1.0 gobject-introspection-1.00
Package 'JavaScript' requires 'nspr >= 4.8.6' but version of NSPR is 4.8.4
Comment 2 Tollef Fog Heen 2011-04-13 13:04:33 UTC

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

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.