Re: Lower priority of the configure option --with-libraries causes wrong lib resolution

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Charles Samborski <demurgos@demurgos.net>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2025-06-15T20:26:01Z
Lists: 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



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Don't put library-supplied -L/-I switches before user-supplied ones.

  2. psql: Change new \conninfo to use SSL instead of TLS