pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Charles Samborski <demurgos@demurgos.net>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: Lower priority of the configure option --with-libraries causes wrong lib resolution
Date: Sun, 15 Jun 2025 16:26:01 -0400
Message-ID: <311720.1750019161@sss.pgh.pa.us> (raw)
In-Reply-To: <70f2155f-27ca-4534-b33d-7750e20633d7@demurgos.net>
References: <70f2155f-27ca-4534-b33d-7750e20633d7@demurgos.net>

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





view thread (4+ messages)  latest in thread

Message-ID: <311720.1750019161@sss.pgh.pa.us>
Permalink:  ../311720.1750019161@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/311720.1750019161@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, demurgos@demurgos.net, pgsql-bugs@lists.postgresql.org
  Subject: Re: Lower priority of the configure option --with-libraries causes wrong lib resolution
  In-Reply-To: <311720.1750019161@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox