[Interest] link error (and probably a dumb question)

Thiago Macieira thiago.macieira at intel.com
Thu Sep 17 23:27:26 CEST 2015


On Thursday 17 September 2015 18:50:09 René J. V. Bertin wrote:
> Thiago Macieira wrote:
> > The files do contain the -L setting but pkg-config should strip them out.
> > 
> > $ grep Libs: /usr/lib64/pkgconfig/{dbus-1,glib-2.0}.pc
> > /usr/lib64/pkgconfig/dbus-1.pc:Libs: -L${libdir} -ldbus-1
> > /usr/lib64/pkgconfig/glib-2.0.pc:Libs: -L${libdir} -lglib-2.0
> > 
> > $ pkg-config --libs dbus-1 glib-2.0
> > -ldbus-1 -lglib-2.0
> > 
> > 
> > Yours didn't.
> 
> It does, but not when I invoke it like this
> $ env PKG_CONFIG_PATH=/usr/lib64/pkgconfig pkg-config --libs dbus-1
> 
> I'd be curious to know if your pkg-config still strips the arch-specific
> path out of its response.

It does:

$ env PKG_CONFIG_PATH=/usr/lib64/pkgconfig pkg-config --libs dbus-1
-ldbus-1 

The problem is that your pkg-config is apparently configured to understand 
something else (probably /usr/lib) as the system default path. So when you ask 
for it to search .pc files in /usr/lib64/pkgconfig (which installed libraries in 
/usr/lib64), then it thinks those paths are not system-default and prints 
them.

Your pkg-config is buggy. Your distribution must fix them.

This also shows that pkg-config is flawed for multiarch builds.

> > Those variables are for qmake's internal use, it doesn't apply to
> > pkg-config.
> I know it doesn't apply to pkg-config, but does qmake have any more business
> with those paths than pkg-config has?

There's some extra processing that it does. For paths added to INCLUDEPATH 
that begin with one of the paths in QMAKE_DEFAULT_INCDIRS, qmake will use the 
-isystem option instead of -I to pass to the compiler. It uses 
QMAKE_DEFAULT_LIBDIRS to *search* for libraries you passed in LIBS += without 
the corresponding -L flag, like for example:

	LIBS += -lm -lrt

It will not strip any paths added to LIBS.

Your pkg-config is still broken.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list