What to do for pc files for static-only lib installs
Paul Smith
psmith at gnu.org
Thu Sep 12 19:06:24 UTC 2024
In an environment I'm creating, I want to only ever use static
libraries. So, when I build a library I only install the static
library not the shared libraries.
However, this is problematic because the pc file for these packages
will contain a Libs: and a Libs.private: section, like:
Libs: -L${libdir} -lfoo
Libs.private: -dl -pthread
When other tools run pkg-config they don't provide the --static option
to pkg-config: they don't know that I've only installed the static
libs, and so in their configure.ac or whatever they just run
"pkg-config --libs libfoo" and this gives the wrong flags.
Am I missing a trick, or is this just a case of unsupported territory?
What is the right thing to do here?
Is this on me, to adjust the pc file myself if I'm only going to be
installing the static library? For example, by taking the Libs.private
contents and adding it to Libs by postprocessing the .pc file at
install time?
Should we consider providing "standard" recommendations for how
packages that INSTALL PC files should handle this? There is already an
autoconf --without-shared option that is somewhat common, but I've
never seen a package that uses this to change the contents of its .pc
file (and it's not available everywhere of course).
Is there something we should recommend for packages that USE PC files
about how to make this work better themselves?
More information about the pkg-config
mailing list