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
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.
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
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.