[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

automagic pkg-config search path detection is bad, please remove it

From: Ariadne Conill
Subject: automagic pkg-config search path detection is bad, please remove it
Date: Mon, 25 Oct 2021 06:32:07 -0500 (CDT)


I am the maintainer of pkgconf, one of the mainly used pkg-config implementations. As a result of the problems with ncurses over the weekend in Alpine, I became aware of the new pkg-config path detection feature in ncurses' configure script.

I believe this feature to be philosophically and technically flawed, and plan to argue both points, as well as note a technical mitigation.

First, the philosophical concern: I don't think this feature is beneficial to end-users of ncurses. The reason why is because user packages are almost always installed to /usr/local/lib/pkgconfig, which has been the defacto standard for the past 15 years. Yes, there are some pkg-config implementations out in the wild which still check $datadir/pkg-config, but this has never been typical behavior of the pkg-config tool to search that path.

It is actively hostile toward distributions, as distributions build pkg-config with /usr/local paths first, so that user packages can be preferred over system ones. If a distribution uses this automatic detection, it will detect the user path (since it comes first in the search list) instead of the system path.

Now, for the technical concern: the automatic detection is dependent on the debug output of pkg-config or pkgconf. The debug output of either tool is not something that should be considered a stable interface, and is subject to change at the whim of the maintainer. Related to this point, I plan on overhauling the debug output in pkgconf 2.0 anyway, as part of refactoring/rewriting that is already ongoing. This new debug output will likely not be compatible with your autoconf macro.

A portable way of learning the pkg-config search path already exists:

$ pkgconf --variable=pc_path pkg-config

This portable way will work with the major implementations: we all agreed to implement it explicitly for users to query the search path.

But, really, please just install by default to $libdir/pkgconfig and get rid of all of this magic stuff. That's all you need to do. If some distribution is doing something else that's weird, by now, they surely have support for the /usr/local/lib/pkgconfig path.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]