Serious problem with standard library paths and order of -L flags

Michael Adam obnox at samba.org
Tue Jun 17 07:11:09 MDT 2014


On 2014-06-17 at 14:13 +0200, Jelmer Vernooij wrote:
> On Tue, Jun 17, 2014 at 01:52:20PM +0200, Michael Adam wrote:
> > ...
> > 
> > I have two patches hacked into our waf build (pair-hacked
> > with Metze) that makes the internals skip a library path
> > handed in from (e.g.) pkg-config if it is a standard or
> > well-known library path. This fixes it for me on my
> > ubuntu 64 bit system, but of course this is not portable!
> > (patches attached...)
> > 
> > ==> Question to the list (Jelmer?...):
> > 
> > Is there a good way to retrieve a list of "standard"
> > library paths from the system (via python)?
> > 
> > (Or does anybody have an idea how to solve this differntly?)
> 
> I agree with the thoughts behind the change.
> 
> Please don't modify the upstream waf source
> (buildtools/wafadmin), but rather do this by wrapping things in
> wafsamba. Otherwise we won't be able to update to newer
> versions of waf.

I'll do that if possible.
Last time, there was a -L flag ordering problem,
I fixed it in wafadmin and ita brought my patch
upstream. If there is no bug generic in waf,
I'll fix it in wafsamba.

> We should probably also support more platforms than just x86_64-linux.

Sure. That was just an example... Hence my mail. :)

> Note that pkg-config will by default filter out standard system
> paths (see its manpage). It will only output -L/usr/lib if you
> set PKG_CONFIG_ALLOW_SYSTEM_LIBS.

Ah! Good to know.

> Ideally we should be relying on pkg-config instead of custom
> tools like cups-config that are broken.

Hm, but I don't think we can avoid cups-config for cups.
I just checked: on my system cups-config is a shell script
that does this somewhere:

    if test $libdir != /usr/lib -a $libdir != /usr/lib32 -a
    $libdir != /usr/lib64; then
         LDFLAGS="$LDFLAGS -L$libdir"
    fi

So it has some code to exclude system paths, but that is
not portable... :-/

Thanks for your input, still uncertain what to
do for cups though.

And, by the way, python-config has a similar problem
(which was what hit us in the referenced bug #10515).
"python-config --ldflags" contains "-L/usr/lib" on my
system. And there does not seem to be a way to disable
this.

It seems there is a pkg-config file for python, so one
could possibly use pkg-config. But wafadmin uses python-config.

Cheers - Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140617/ab74ca1f/attachment.pgp>


More information about the samba-technical mailing list