Re: Lower priority of the configure option --with-libraries causes wrong lib resolution - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Lower priority of the configure option --with-libraries causes wrong lib resolution
Date
Msg-id 311720.1750019161@sss.pgh.pa.us
Whole thread Raw
In response to Lower priority of the configure option --with-libraries causes wrong lib resolution  (Charles Samborski <demurgos@demurgos.net>)
List pgsql-bugs
Charles Samborski <demurgos@demurgos.net> writes:
> Swapping the two flags so the order is `-L/postgres-deps/lib -L/usr/lib` 
> fixes the build. I consider it very surprising that that libraries 
> passed with `--with-libraries` have lower priority, I would expect 
> explicitly requested libraries to have the highest priority.

Ugh.

> First, `/usr/lib` is added in the clang configuration [1]. It is 
> retrieved from `/usr/bin/llvm-config --ldflags`.

I would pin the blame here.  This code should not be messing with
the global LDFLAGS.  -L switches from llvm-config should probably
go into LLVM_LIBS instead, so that they're only applied while
linking llvmjit.so.  (Compare the handling of -L switches from
python or perl: those go into python_libspec or perl_embed_ldflags,
they're not applied globally.)

Can you check whether a change along that line fixes the problem
in your environment?

> My workaround is to update the configure script to instead prepend 
> `LIBDIRS` at the start of `LDFLAGS` using `LDFLAGS="$LIBDIRS $LDFLAGS"`. 

I don't think we'd accept that: it seems about as likely to break
builds as fix them.  Notably, users might've themselves modified
LDFLAGS to contain -L switches.  While that's not good practice
IMO, we shouldn't make changes that are more sweeping than
necessary.

            regards, tom lane



pgsql-bugs by date:

Previous
From: Charles Samborski
Date:
Subject: Lower priority of the configure option --with-libraries causes wrong lib resolution
Next
From: Tom Lane
Date:
Subject: Re: Lower priority of the configure option --with-libraries causes wrong lib resolution