summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2020-11-20 05:58:26 +0000
committerTom Lane2020-11-20 05:58:26 +0000
commit2bb8c0f1d94dd4b2d23ae56b2f5ebec785d2df7b (patch)
tree13889d670fcc8424f0f7b431746c38e61747b19c
parent6631d5f261e9fdc2ccc2a81214a45865d6e59122 (diff)
On macOS, use -isysroot in link steps as well as compile steps.
We previously put the -isysroot switch only into CPPFLAGS, theorizing that it was only needed to find the right copies of include files. However, it seems that we also need to use it while linking programs, to find the right stub ".tbd" files for libraries. We got away without that up to now, but apparently that was mostly luck. It may also be that failures are only observed when the Xcode version is noticeably out of sync with the host macOS version; the case that's prompting action right now is that builds fail when using latest Xcode (12.2) on macOS Catalina, even though it's fine on Big Sur. Hence, add -isysroot to LDFLAGS as well. (It seems that the more common practice is to put it in CFLAGS, whence it'd be included at both compile and link steps. However, we can't mess with CFLAGS in the platform template file without confusing configure's logic for choosing default CFLAGS.) Back-patch of 49407dc32 into all supported branches. Report and patch by James Hilliard (some cosmetic mods by me) Discussion: https://postgr.es/m/[email protected]
-rwxr-xr-xconfigure2
-rw-r--r--configure.in2
-rw-r--r--src/template/darwin1
3 files changed, 5 insertions, 0 deletions
diff --git a/configure b/configure
index 45210d0febc..8b9ed8eb825 100755
--- a/configure
+++ b/configure
@@ -16285,8 +16285,10 @@ _ACEOF
# literally, so that it's possible to override it at build time using
# a command like "make ... PG_SYSROOT=path". This has to be done after
# we've finished all configure checks that depend on CPPFLAGS.
+# The same for LDFLAGS, too.
if test x"$PG_SYSROOT" != x; then
CPPFLAGS=`echo "$CPPFLAGS" | sed -e "s| $PG_SYSROOT | \\\$(PG_SYSROOT) |"`
+ LDFLAGS=`echo "$LDFLAGS" | sed -e "s| $PG_SYSROOT | \\\$(PG_SYSROOT) |"`
fi
diff --git a/configure.in b/configure.in
index 2082ee866b8..607fd9ae6d6 100644
--- a/configure.in
+++ b/configure.in
@@ -2227,8 +2227,10 @@ AC_SUBST(PG_VERSION_NUM)
# literally, so that it's possible to override it at build time using
# a command like "make ... PG_SYSROOT=path". This has to be done after
# we've finished all configure checks that depend on CPPFLAGS.
+# The same for LDFLAGS, too.
if test x"$PG_SYSROOT" != x; then
CPPFLAGS=`echo "$CPPFLAGS" | sed -e "s| $PG_SYSROOT | \\\$(PG_SYSROOT) |"`
+ LDFLAGS=`echo "$LDFLAGS" | sed -e "s| $PG_SYSROOT | \\\$(PG_SYSROOT) |"`
fi
AC_SUBST(PG_SYSROOT)
diff --git a/src/template/darwin b/src/template/darwin
index f4d4e9d7cf8..32414d21a98 100644
--- a/src/template/darwin
+++ b/src/template/darwin
@@ -11,6 +11,7 @@ fi
if test x"$PG_SYSROOT" != x"" ; then
if test -d "$PG_SYSROOT" ; then
CPPFLAGS="-isysroot $PG_SYSROOT $CPPFLAGS"
+ LDFLAGS="-isysroot $PG_SYSROOT $LDFLAGS"
else
PG_SYSROOT=""
fi