Bugzilla – Bug 58363
`pkg-config --libs` should swallow -L/lib like it does with -L/usr/lib
Last modified: 2012-12-19 15:33:04 UTC
This is coming from: http://bugs.gentoo.org/445796
I've noticed, for a long time now, that pkg-config doesn't print -L flags for system path(s) like /usr/lib with --libs argument
However, it still prints -L/lib and doesn't act like it does for -L/usr/lib
Quoting Mike Frysinger from the downstream bug:
"pkg-config should automatically skip it. it has logic internally to do this for /usr/lib and /usr/lib64 and ..."
Please read the downstream bug and you will notice this oddity is actually causing issues.
Created attachment 71591 [details] [review]
Add root /lib* directories to the default -L paths
Avoids outputting -L/lib, which the linker will search in implicitly like -L/usr/lib.
Freedesktop #58363 (https://bugs.freedesktop.org/show_bug.cgi?id=58363)
I can't believe I never noticed that before. Does the attached patch help?
On the other hand, I'm a little wary of encoding this behavior by default since I'm only familiar with gcc, which does contain /lib in it's default. Gentoo could easily just configure their pkg-config with --with-system-library-path=/usr/lib:/lib or whatever you want to tune it to.
What do you guys think? Mike?
I'm waiting for a comment from other Gentoo developers (made a query on IRC) and if nobody is seeing a problem this would introduce, I'm going to apply the patch for testing with a incremental revision bumped package tomorrow.
I'd rather see the configure.ac patched like you just did, than pass the ./configure flag manually, it just makes sense to have by default there.
(In reply to comment #3)
> I'd rather see the configure.ac patched like you just did, than pass the
> ./configure flag manually, it just makes sense to have by default there.
Right, I'm questioning whether it makes sense that is the default for everybody. For GCC/GNU LD, yeah definitely this makes sense. But does it for every toolchain? I suppose the alternate toolchains would be more in the minority and the onus would be on those users to configure with their correct --with-system-library-path.
(In reply to comment #4)
if pkg-config is doing it for /usr/lib type paths, then it makes sense for /lib type paths too. i don't think the underlying toolchain matters.
however, the proposed patch isn't complete :/. to be fair, the existing code isn't complete either. it misses standard ABI dirs like lib32 and libx32.
maybe the existing code could read:
pc_lib_sfx=$(echo "$libdir" | sed 's:.*/lib::')
case "$pc_lib_sfx" in
(In reply to comment #5)
> pc_lib_sfx=$(echo "$libdir" | sed 's:.*/lib::')
> case "$pc_lib_sfx" in
Yep, good call. I added this as a second commit and have now pushed them both. The bug is fixed in 72e1346, and the addition to handle various ABIs is in 4dac402 authored by you.