On Friday 07 December 2007, Stepan Kasal wrote: > 1) > The most important one is this: > > $ pkg-config --libs blkid > -L/lib -lblkid -luuid -ldevmapper > > The "-ldevmapper" option is not only redundant, it's very evil. > Se below for a detailed explanation (let's call this "so-deps hell"). > > Karel proposes to add --as-needed (or -Wl,--as-needed) to *_LDFLAGS > for dynamic linking to fix this. (configure has to check that > --as-needed is available, of course.) > > My proposal would be to use hardwired "-lblkid -luuid" for dynamic > linking and start using pkg-config only when/if it is really needed, > ie. a real-world bug report arrives. i learned about a new option in .pc files which i think the blkid.pc provider should be fixed to use: Libs: -L${libdir} -lblkid Libs.private: -luuid -ldevmapper so now when you run `pkg-config --libs`, you get the normal thing of just "-Llib -lblkid" which is what we want. if you need to do static linking, just use `pkg-config --libs --static` and you'll get a full list of libraries which are needed when you do static linking. i think this addresses the ugly excessive SONAME propagation ("so-dep hell") and alleviates the need for --as-needed at all. > 2) > Second problem: > As a disiplined citizen of the Automake world, you should put -l and > -L options to *_LDADD and the rest to *_LDFLAGS. > Though the pkg-config script has options which enable to solve this, > Autoconf macros in pkg.m4 do not use them. > One has to do something like: > BLKID_LDADD=$(pkg-config --libs-only-l blkid)" "$(pkg-config --libs-only-L > blkid) BLKID_LDFLAGS=$(pkg-config --libs-only-other blkid) > > It's a question whether the pkg.m4 macros should be used in > configure.ac, or whether they shall serve only as an inspiration for > our code. Roughly speaking, we would call > AC_RUN_LOG([pkg-config --exists --print-errors blkid]) > and check whether the --libs-only-* options are supported before the > above assignments. > But Karel suggests we use PKG_CHECK_EXISTS from pkg.m4 for this (that > would include a version number check to ensure --libs-only-* are > available). > > Yes, this cries for a fix in pkg.m4, but the fact that the old > broken interface has to be maintained may complicate the situation... an optional additional argument to the PKG_CHECK_EXISTS macro that, when not provided gives old behavior and when provided, controls the newer proper behavior ? since this sounds like architectual issues, i think the best route would be parallel ones: - have a local pkg.m4 that does what we need - engage with pkg-config maintainers to see if we can drive the direction -mike
Attachment:
signature.asc
Description: This is a digitally signed message part.