Bug 62607 - Returning highest version when multiple .pc files found in PKG_CONFIG_PATH
Summary: Returning highest version when multiple .pc files found in PKG_CONFIG_PATH
Status: RESOLVED WONTFIX
Alias: None
Product: pkg-config
Classification: Unclassified
Component: src (show other bugs)
Version: unspecified
Hardware: Other All
: medium enhancement
Assignee: pkg-config
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-21 20:02 UTC by Rhys Ulerich
Modified: 2013-04-16 12:30 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Rhys Ulerich 2013-03-21 20:02:56 UTC
This is a question/feature request.

When multiple .pc files can be found in $PKG_CONFIG_PATH and they report distinct versions, is there any mechanism to return the "largest" version?

There admittedly is runtime overhead as pkg-config can stop searching currently, but the overhead shouldn't be much worse than if the match happened to be found at the end of the PKG_CONFIG_PATH.

Some quick experimentation makes it seem like pkg-config stops after the first satisfactory version is detected.

Thanks,
Rhys
Comment 1 Dan Nicholson 2013-04-06 18:47:58 UTC
Hmm, not sure what to do about this.

On the one hand, I like the idea and don't think it would be too much trouble to get it to do this. However, I'm pretty sure it could get messed up pretty easily.

The reason pkg-config uses the first version found in the path isn't just for convenience, it's also because it produces the most predictable results when mixing packages found at different locations in the path. Say you have glib and cairo in both /usr/local/lib/pkgconfig and /usr/lib/pkgconfig. If you don't use both .pc files in /usr/local, what happens when pkg-config starts outputting -L/usr/local/lib? You're going to end up using the version in /usr/local, anyway.

pkg-config actually jumps through some hoops to keep track of where in the path the package was found from and reorders the packages so you're most likely to get your /usr/local packages first and /usr packages second and not get weird mixtures. It would be difficult to get the same guarantees when mixing in highest version, too.
Comment 2 Rhys Ulerich 2013-04-14 17:07:03 UTC
I'd not appreciated the reordering pkg-config did in that regard.  It would definitely be difficult to honor highest version, not break the existing behavior, and behave in a reasonable manner for everyone.

Thanks for taking a look and explaining your rationale.  Feel free to close this one.

- Rhys
Comment 3 Dan Nicholson 2013-04-16 12:30:47 UTC
Thanks for understanding.


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.