Bug 43149 - --exists returns true, but --cflags broken
Summary: --exists returns true, but --cflags broken
Status: RESOLVED FIXED
Alias: None
Product: pkg-config
Classification: Unclassified
Component: src (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Dan Nicholson
QA Contact:
URL:
Whiteboard:
Keywords:
: 58847 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-11-21 14:17 UTC by David Schleef
Modified: 2012-12-29 13:45 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
[1/2] Make check-missing test more explicit with --exists (1.38 KB, patch)
2012-06-07 05:56 UTC, Dan Nicholson
Details | Splinter Review
[2/2] Enable Requires and Requires.private for --exists (2.05 KB, patch)
2012-06-07 05:57 UTC, Dan Nicholson
Details | Splinter Review

Description David Schleef 2011-11-21 14:17:35 UTC
$ pkg-config --exists libsoup-2.4 && echo exists
exists
$ pkg-config --cflags libsoup-2.4
Package libtasn1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libtasn1.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libtasn1', required by 'GnuTLS', not found


Of course, the real bug is that my libsoup-2.4.pc file is broken.  But, imo, --exists should check the same things as --cflags before returning TRUE.  A side effect is that the pkg.m4 macro does not notice this error, and merrily continues on with SOUP_CFLAGS equal to "".

version is 0.25
Comment 1 Dan Nicholson 2012-06-07 05:56:59 UTC
Created attachment 62712 [details] [review]
[1/2] Make check-missing test more explicit with --exists


Currently the check-missing passes the packages on the command line with
no options prior to running through --cflags/--libs, etc. Make this more
explicitly pass --exists since this is a much more common operation
performed from PKG_CHECK_MODULES.

The expected result of 0 when Requires or Requires.private is missing is
a regression from pre-0.24 pkg-config.
---
 check/check-missing |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
Comment 2 Dan Nicholson 2012-06-07 05:57:04 UTC
Created attachment 62713 [details] [review]
[2/2] Enable Requires and Requires.private for --exists


Prior to pkg-config 0.24, --exists honored Requires and
Requires.private. This was regressed in commits 02d5ae3f and 669bfe2e,
which split the handling of Requires and Requires.private out more
correctly for other options. This adds exists to the group of options
that enable the Requires functionality.

Freedesktop #43149
---
 check/check-missing |    6 +++---
 main.c              |    5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)
Comment 3 Dan Nicholson 2012-06-07 05:57:40 UTC
OK, I think I found the issue. This was a change that went into pkg-config-0.24 with commits 02d5ae3f and 669bfe2e. It's a regression in that previously --exists honored Requires and Requires.private. Can you see if the attached patches help?
Comment 4 David Schleef 2012-06-07 08:09:02 UTC
Thanks, completely forgot about this.

I don't have means to test this anymore.  If I had been a wise bug report sumbitter in november, I would have attached the problematic .pc file.

Let's assume it's fixed.
Comment 5 Peter Hutterer 2012-06-11 18:56:22 UTC
Confirmed, tested with gtk+-2.0 and a missing dependency of libpng12. This was what originally triggered the issue on my machine. (needs to be manually added now, I had some stale tree previously)

Tested 6c27d5051ba9d81484edffe334c152a05fa2c6d8 (current master)
 --exists returns 0, --cflags shows error
Tested same commit with the two patches applied
 --exists returns 1, --cflags shows error

So the behaviour is now what I expect, configure fails on --exist now, the error message is in config.log. Confirmed as fixed.
Comment 6 Dan Nicholson 2012-08-14 12:42:20 UTC
This got fixed in commit 3ead3dfb and released in pkg-config-0.27.
Comment 7 Dan Nicholson 2012-12-29 13:45:58 UTC
*** Bug 58847 has been marked as a duplicate of this bug. ***


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.