Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 445796 - dev-util/pkgconfig: `pkg-config --libs` should swallow -L/lib like it does with -L/usr/lib
Summary: dev-util/pkgconfig: `pkg-config --libs` should swallow -L/lib like it does wi...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Freedesktop bugs
URL:
Whiteboard:
Keywords:
Depends on: 455578
Blocks:
  Show dependency tree
 
Reported: 2012-12-03 13:39 UTC by Bertrand Jacquin
Modified: 2014-07-29 06:14 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bertrand Jacquin 2012-12-03 13:39:58 UTC
cross-pkg-config prefix with $SYSROOT -I and -L when it does start with /usr :

# i586-pc-linux-gnu-pkg-config  --cflags --libs libipq
 -L/usr/i586-pc-linux-gnu/usr/lib -lipq

While with no wrapper :

# PKG_CONFIG_LIBDIR=/usr/i586-pc-linux-gnu/usr/lib/pkgconfig:/usr/i586-pc-linux-gnu/usr/share/pkgconfig pkg-config --cflags --libs libipq
 -L/usr/lib -lipq

But when .pc file has libdir=/lib, it does not prefix correctly :

# PKG_CONFIG_LIBDIR=/usr/i586-pc-linux-gnu/usr/lib/pkgconfig:/usr/i586-pc-linux-gnu/usr/share/pkgconfig pkg-config --cflags --libs libmnl
 -L/lib -lmnl

libmnl.pc file :

prefix=/usr
exec_prefix=${prefix}
libdir=/lib
includedir=${prefix}/include

Name: libmnl
Description: Minimalistic Netlink communication library
URL: http://netfilter.org/projects/libmnl/
Version: 1.0.2
Requires:
Conflicts:
Libs: -L${libdir} -lmnl
Cflags: -I${includedir}

# i586-pc-linux-gnu-pkg-config --cflags --libs libmnl
cross-pkg-config: warning: ### falling down so here is a dump state ######
Error printing enabled by default due to use of --version, --libs, --cflags, --libs-only-l, --libs-only-L, --libs-only-other, --cflags-only-I, --cflags-only-other or --list. Value of --silence-errors: 0
Error printing enabled
Adding virtual 'pkg-config' package to list of known packages
Scanning directory '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig'
Ignoring file '.' in search directory; not a .pc file
Ignoring file '..' in search directory; not a .pc file
File 'libffi.pc' appears to be a .pc file
Will find package 'libffi' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/libffi.pc'
File 'libipq.pc' appears to be a .pc file
Will find package 'libipq' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/libipq.pc'
File 'glib-2.0.pc' appears to be a .pc file
Will find package 'glib-2.0' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/glib-2.0.pc'
File 'libmnl.pc' appears to be a .pc file
Will find package 'libmnl' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/libmnl.pc'
File 'gmodule-no-export-2.0.pc' appears to be a .pc file
Will find package 'gmodule-no-export-2.0' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/gmodule-no-export-2.0.pc'
File 'gmodule-export-2.0.pc' appears to be a .pc file
Will find package 'gmodule-export-2.0' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/gmodule-export-2.0.pc'
File 'gio-2.0.pc' appears to be a .pc file
Will find package 'gio-2.0' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/gio-2.0.pc'
File 'libxml-2.0.pc' appears to be a .pc file
Will find package 'libxml-2.0' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/libxml-2.0.pc'
File 'gmodule-2.0.pc' appears to be a .pc file
Will find package 'gmodule-2.0' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/gmodule-2.0.pc'
File 'gio-unix-2.0.pc' appears to be a .pc file
Will find package 'gio-unix-2.0' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/gio-unix-2.0.pc'
File 'gthread-2.0.pc' appears to be a .pc file
Will find package 'gthread-2.0' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/gthread-2.0.pc'
File 'gobject-2.0.pc' appears to be a .pc file
Will find package 'gobject-2.0' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/gobject-2.0.pc'
Cannot open directory '/usr/i586-pc-linux-gnu/usr/share/pkgconfig' in package search path: No such file or directory
Looking for package 'libmnl'
Looking for package 'libmnl-uninstalled'
Reading 'libmnl' from file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/libmnl.pc'
Parsing package file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/libmnl.pc'
  line>
  line>
  line>prefix=/usr
 Variable declaration, 'prefix' has value '/usr'
  line>exec_prefix=${prefix}
 Variable declaration, 'exec_prefix' has value '/usr'
  line>libdir=/lib
 Variable declaration, 'libdir' has value '/lib'
  line>includedir=${prefix}/include
 Variable declaration, 'includedir' has value '/usr/include'
  line>
  line>Name: libmnl
  line>Description: Minimalistic Netlink communication library
  line>URL: http://netfilter.org/projects/libmnl/
  line>Version: 1.0.2
  line>Requires:
  line>Conflicts:
  line>Libs: -L${libdir} -lmnl
  line>Cflags: -I${includedir}
Path position of 'libmnl' is 1
Package libmnl has -I/usr/include in Cflags
Removing -I/usr/include from cflags for libmnl
Adding 'libmnl' to list of known packages, returning as package 'libmnl'
 original:  libmnl 
 sorted:  libmnl 
 original:  libmnl 
 sorted:  libmnl 
 original:  libmnl 
 sorted:  libmnl 
 original:  libmnl 
 sorted:  libmnl 
 -L/lib -lmnl  
cross-pkg-config: warning: ### end of dump ###############################
cross-pkg-config: warning: ### suspicious compile flags dumped here ######
-L/lib
cross-pkg-config: warning: ### end of flag dump ##########################
cross-pkg-config: error: host -I or -L paths detected:  -L/lib -lmnl  

The following sed fix the output modification (for output= definition) :

pkg-config --cflags --libs libmnl | sed -e 's:\(-[IL][[:space:]]*\)\(/usr\|/lib\):\1'"${SYSROOT}"'\2:g'
 -L/usr/i586-pc-linux-gnu/lib -lmnl  

Maybe a negative lookahead could be not generic here ?

Reproducible: Always
Comment 1 SpanKY gentoo-dev 2012-12-05 22:32:49 UTC
pkg-config should not be outputting -L/lib in the first place
Comment 2 Bertrand Jacquin 2012-12-06 12:39:30 UTC
(In reply to comment #1)
> pkg-config should not be outputting -L/lib in the first place

So for you, it's a bug in libmnl ? It's shouldn't place .so files in /lib ?

There no reason for that imho.
Comment 3 Bertrand Jacquin 2012-12-06 12:42:18 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > pkg-config should not be outputting -L/lib in the first place
> 
> So for you, it's a bug in libmnl ? It's shouldn't place .so files in /lib ?
> 
> There no reason for that imho.

Or maybe just in ebuild :

 src_configure() {
         econf \
-                --libdir="${EPREFIX}"/$(get_libdir)
+                --libdir="${EPREFIX}"/usr/$(get_libdir)
 }
Comment 4 SpanKY gentoo-dev 2012-12-07 18:31:12 UTC
(In reply to comment #2)

no, i'm not saying that at all.  i am saying that if a .pc file uses a standard system libdir such as /lib or /lib64 or ..., pkg-config should automatically skip it.  it has logic internally to do this for /usr/lib and /usr/lib64 and ...
Comment 5 Samuli Suominen (RETIRED) gentoo-dev 2013-01-24 14:32:01 UTC
fixed in 0.28 and 9999
Comment 6 Bertrand Jacquin 2013-10-05 18:46:03 UTC
(In reply to Samuli Suominen from comment #5)
> fixed in 0.28 and 9999

I have to say that it's not OK with dev-util/pkgconfig-0.28

# PKG_CONFIG_LIBDIR=/usr/i586-pc-linux-gnu/usr/lib/pkgconfig:/usr/i586-pc-linux-gnu/usr/share/pkgconfig pkg-config --cflags --libs libmnl
-L/lib -lmnl

# i586-pc-linux-gnu-pkg-config --cflags --libs libmnl
cross-pkg-config: warning: ### falling down so here is a dump state ######
Error printing enabled by default due to use of output options besides --exists or --atleast/exact/max-version. Value of --silence-errors: 0
Error printing enabled
Adding virtual 'pkg-config' package to list of known packages
Scanning directory '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig'
Ignoring file '.' in search directory; not a .pc file
Ignoring file '..' in search directory; not a .pc file
File 'libffi.pc' appears to be a .pc file
Will find package 'libffi' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/libffi.pc'
File 'expat.pc' appears to be a .pc file
Will find package 'expat' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/expat.pc'
File 'openssl.pc' appears to be a .pc file
Will find package 'openssl' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/openssl.pc'
File 'libipq.pc' appears to be a .pc file
Will find package 'libipq' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/libipq.pc'
File 'sqlite3.pc' appears to be a .pc file
Will find package 'sqlite3' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/sqlite3.pc'
File 'glib-2.0.pc' appears to be a .pc file
Will find package 'glib-2.0' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/glib-2.0.pc'
File 'libmnl.pc' appears to be a .pc file
Will find package 'libmnl' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/libmnl.pc'
File 'libip4tc.pc' appears to be a .pc file
Will find package 'libip4tc' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/libip4tc.pc'
File 'libpci.pc' appears to be a .pc file
Will find package 'libpci' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/libpci.pc'
File 'python-3.2.pc' appears to be a .pc file
Will find package 'python-3.2' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/python-3.2.pc'
File 'libip6tc.pc' appears to be a .pc file
Will find package 'libip6tc' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/libip6tc.pc'
File 'libssl.pc' appears to be a .pc file
Will find package 'libssl' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/libssl.pc'
File 'gmodule-no-export-2.0.pc' appears to be a .pc file
Will find package 'gmodule-no-export-2.0' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/gmodule-no-export-2.0.pc'
File 'libnl-1.pc' appears to be a .pc file
Will find package 'libnl-1' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/libnl-1.pc'
File 'libcrypto.pc' appears to be a .pc file
Will find package 'libcrypto' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/libcrypto.pc'
File 'panel.pc' appears to be a .pc file
Will find package 'panel' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/panel.pc'
File 'zlib.pc' appears to be a .pc file
Will find package 'zlib' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/zlib.pc'
File 'xtables.pc' appears to be a .pc file
Will find package 'xtables' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/xtables.pc'
File 'menu.pc' appears to be a .pc file
Will find package 'menu' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/menu.pc'
File 'gmodule-export-2.0.pc' appears to be a .pc file
Will find package 'gmodule-export-2.0' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/gmodule-export-2.0.pc'
File 'form.pc' appears to be a .pc file
Will find package 'form' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/form.pc'
File 'gio-2.0.pc' appears to be a .pc file
Will find package 'gio-2.0' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/gio-2.0.pc'
File 'ncurses.pc' appears to be a .pc file
Will find package 'ncurses' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/ncurses.pc'
File 'libxml-2.0.pc' appears to be a .pc file
Will find package 'libxml-2.0' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/libxml-2.0.pc'
File 'libiptc.pc' appears to be a .pc file
Will find package 'libiptc' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/libiptc.pc'
File 'iksemel.pc' appears to be a .pc file
Will find package 'iksemel' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/iksemel.pc'
File 'gmodule-2.0.pc' appears to be a .pc file
Will find package 'gmodule-2.0' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/gmodule-2.0.pc'
File 'gio-unix-2.0.pc' appears to be a .pc file
Will find package 'gio-unix-2.0' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/gio-unix-2.0.pc'
File 'gthread-2.0.pc' appears to be a .pc file
Will find package 'gthread-2.0' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/gthread-2.0.pc'
File 'libnfnetlink.pc' appears to be a .pc file
Will find package 'libnfnetlink' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/libnfnetlink.pc'
File 'libcurl.pc' appears to be a .pc file
Will find package 'libcurl' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/libcurl.pc'
File 'libkmod.pc' appears to be a .pc file
Will find package 'libkmod' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/libkmod.pc'
File 'popt.pc' appears to be a .pc file
Will find package 'popt' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/popt.pc'
File 'gobject-2.0.pc' appears to be a .pc file
Will find package 'gobject-2.0' in file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/gobject-2.0.pc'
Scanning directory '/usr/i586-pc-linux-gnu/usr/share/pkgconfig'
Ignoring file '.' in search directory; not a .pc file
Ignoring file '..' in search directory; not a .pc file
Looking for package 'libmnl'
Looking for package 'libmnl-uninstalled'
Reading 'libmnl' from file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/libmnl.pc'
Parsing package file '/usr/i586-pc-linux-gnu/usr/lib/pkgconfig/libmnl.pc'
  line>
  line>
  line>prefix=/usr
 Variable declaration, 'prefix' has value '/usr'
  line>exec_prefix=${prefix}
 Variable declaration, 'exec_prefix' has value '/usr'
  line>libdir=/lib
 Variable declaration, 'libdir' has value '/lib'
  line>includedir=${prefix}/include
 Variable declaration, 'includedir' has value '/usr/include'
  line>
  line>Name: libmnl
  line>Description: Minimalistic Netlink communication library
  line>URL: http://netfilter.org/projects/libmnl/
  line>Version: 1.0.3
  line>Requires:
  line>Conflicts:
  line>Libs: -L${libdir} -lmnl
  line>Cflags: -I${includedir}
Path position of 'libmnl' is 1
Adding 'libmnl' to list of known packages
Package libmnl has -I/usr/include in Cflags
Removing -I/usr/include from cflags for libmnl
  pre-remove: libmnl
 post-remove: libmnl
adding CFLAGS_OTHER string ""
  pre-remove: libmnl
 post-remove: libmnl
 original: libmnl
   sorted: libmnl
adding CFLAGS_I string ""
  pre-remove: libmnl
 post-remove: libmnl
 original: libmnl
   sorted: libmnl
adding LIBS_L string "-L/lib "
  pre-remove: libmnl
 post-remove: libmnl
adding LIBS_OTHER | LIBS_l string "-lmnl "
returning flags string "-L/lib -lmnl "
-L/lib -lmnl
cross-pkg-config: warning: ### end of dump ###############################
cross-pkg-config: warning: ### suspicious compile flags dumped here ######
-L/lib
cross-pkg-config: warning: ### end of flag dump ##########################
cross-pkg-config: error: host -I or -L paths detected: -L/lib -lmnl

So this deal with error while cross compiling for example net-libs/libnetfilter_acct
Comment 7 Samuli Suominen (RETIRED) gentoo-dev 2014-06-22 12:07:22 UTC
(In reply to Bertrand Jacquin from comment #6)
> (In reply to Samuli Suominen from comment #5)
> > fixed in 0.28 and 9999
> 
> I have to say that it's not OK with dev-util/pkgconfig-0.28

Or are you hitting bug 512336?
Comment 8 Bertrand Jacquin 2014-06-22 13:17:16 UTC
(In reply to Samuli Suominen from comment #7)
> (In reply to Bertrand Jacquin from comment #6)
> > (In reply to Samuli Suominen from comment #5)
> > > fixed in 0.28 and 9999
> > 
> > I have to say that it's not OK with dev-util/pkgconfig-0.28
> 
> Or are you hitting bug 512336?

This is two differents issues here.
Comment 9 SpanKY gentoo-dev 2014-07-29 06:14:59 UTC
i think it's partially that issue, and partially the abi issue

with crossdev-20140729 (which has sysroot improvements) and the fix from bug 512336, libmnl no longer produces output with the cross-pkg-config