Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uQv6x-002lAj-3F for pgsql-bugs@arkaria.postgresql.org; Sun, 15 Jun 2025 21:41:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uQv6s-00E6pL-Vy for pgsql-bugs@arkaria.postgresql.org; Sun, 15 Jun 2025 21:41:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uQv6s-00E6pC-Nf for pgsql-bugs@lists.postgresql.org; Sun, 15 Jun 2025 21:41:51 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uQv6q-002FAU-2v for pgsql-bugs@lists.postgresql.org; Sun, 15 Jun 2025 21:41:50 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 55FLfbSt388001; Sun, 15 Jun 2025 17:41:37 -0400 From: Tom Lane To: Charles Samborski cc: 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> References: <70f2155f-27ca-4534-b33d-7750e20633d7@demurgos.net> <311720.1750019161@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sun, 15 Jun 2025 16:26:01 -0400" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <387981.1750023686.0@sss.pgh.pa.us> Date: Sun, 15 Jun 2025 17:41:37 -0400 Message-ID: <388000.1750023697@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <387981.1750023686.1@sss.pgh.pa.us> I wrote: > I would pin the blame here. This code should not be messing with > the global LDFLAGS. Looking closer, we've made the same mistake elsewhere. I think we need something like the attached to ensure that -L switches coming from libraries' configure helpers don't override user-specified directories. regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="v1-avoid-overriding-libdirs.patch"; charset="us-ascii" Content-ID: <387981.1750023686.2@sss.pgh.pa.us> Content-Description: v1-avoid-overriding-libdirs.patch diff --git a/config/llvm.m4 b/config/llvm.m4 index fa4bedd9370..9d6fe8199e3 100644 --- a/config/llvm.m4 +++ b/config/llvm.m4 @@ -4,7 +4,7 @@ # ----------------- # # Look for the LLVM installation, check that it's new enough, set the -# corresponding LLVM_{CFLAGS,CXXFLAGS,BINPATH} and LDFLAGS +# corresponding LLVM_{CFLAGS,CXXFLAGS,BINPATH,LIBS} # variables. Also verify that CLANG is available, to transform C # into bitcode. # @@ -55,7 +55,7 @@ AC_DEFUN([PGAC_LLVM_SUPPORT], for pgac_option in `$LLVM_CONFIG --ldflags`; do case $pgac_option in - -L*) LDFLAGS="$LDFLAGS $pgac_option";; + -L*) LLVM_LIBS="$LLVM_LIBS $pgac_option";; esac done diff --git a/configure b/configure index 4f15347cc95..09890286e2a 100755 --- a/configure +++ b/configure @@ -5194,7 +5194,7 @@ fi for pgac_option in `$LLVM_CONFIG --ldflags`; do case $pgac_option in - -L*) LDFLAGS="$LDFLAGS $pgac_option";; + -L*) LLVM_LIBS="$LLVM_LIBS $pgac_option";; esac done @@ -9441,7 +9441,7 @@ fi done for pgac_option in $XML2_LIBS; do case $pgac_option in - -L*) LDFLAGS="$LDFLAGS $pgac_option";; + -L*) LIBDIRS="$LIBDIRS $pgac_option";; esac done fi @@ -9671,7 +9671,7 @@ fi done for pgac_option in $LZ4_LIBS; do case $pgac_option in - -L*) LDFLAGS="$LDFLAGS $pgac_option";; + -L*) LIBDIRS="$LIBDIRS $pgac_option";; esac done fi @@ -9812,7 +9812,7 @@ fi done for pgac_option in $ZSTD_LIBS; do case $pgac_option in - -L*) LDFLAGS="$LDFLAGS $pgac_option";; + -L*) LIBDIRS="$LIBDIRS $pgac_option";; esac done fi diff --git a/configure.ac b/configure.ac index 4b8335dc613..99bb2fb5698 100644 --- a/configure.ac +++ b/configure.ac @@ -1108,7 +1108,7 @@ if test "$with_libxml" = yes ; then done for pgac_option in $XML2_LIBS; do case $pgac_option in - -L*) LDFLAGS="$LDFLAGS $pgac_option";; + -L*) LIBDIRS="$LIBDIRS $pgac_option";; esac done fi @@ -1157,7 +1157,7 @@ if test "$with_lz4" = yes; then done for pgac_option in $LZ4_LIBS; do case $pgac_option in - -L*) LDFLAGS="$LDFLAGS $pgac_option";; + -L*) LIBDIRS="$LIBDIRS $pgac_option";; esac done fi @@ -1182,7 +1182,7 @@ if test "$with_zstd" = yes; then done for pgac_option in $ZSTD_LIBS; do case $pgac_option in - -L*) LDFLAGS="$LDFLAGS $pgac_option";; + -L*) LIBDIRS="$LIBDIRS $pgac_option";; esac done fi ------- =_aaaaaaaaaa0--