Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9e9a31b

Browse files
committed
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/20201120003314.20560-1-james.hilliard1@gmail.com
1 parent 98f3f1d commit 9e9a31b

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

configure

+2
Original file line numberDiff line numberDiff line change
@@ -19088,8 +19088,10 @@ _ACEOF
1908819088
# literally, so that it's possible to override it at build time using
1908919089
# a command like "make ... PG_SYSROOT=path". This has to be done after
1909019090
# we've finished all configure checks that depend on CPPFLAGS.
19091+
# The same for LDFLAGS, too.
1909119092
if test x"$PG_SYSROOT" != x; then
1909219093
CPPFLAGS=`echo "$CPPFLAGS" | sed -e "s| $PG_SYSROOT | \\\$(PG_SYSROOT) |"`
19094+
LDFLAGS=`echo "$LDFLAGS" | sed -e "s| $PG_SYSROOT | \\\$(PG_SYSROOT) |"`
1909319095
fi
1909419096

1909519097

configure.in

+2
Original file line numberDiff line numberDiff line change
@@ -2351,8 +2351,10 @@ AC_SUBST(PG_VERSION_NUM)
23512351
# literally, so that it's possible to override it at build time using
23522352
# a command like "make ... PG_SYSROOT=path". This has to be done after
23532353
# we've finished all configure checks that depend on CPPFLAGS.
2354+
# The same for LDFLAGS, too.
23542355
if test x"$PG_SYSROOT" != x; then
23552356
CPPFLAGS=`echo "$CPPFLAGS" | sed -e "s| $PG_SYSROOT | \\\$(PG_SYSROOT) |"`
2357+
LDFLAGS=`echo "$LDFLAGS" | sed -e "s| $PG_SYSROOT | \\\$(PG_SYSROOT) |"`
23562358
fi
23572359
AC_SUBST(PG_SYSROOT)
23582360

src/template/darwin

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ fi
1111
if test x"$PG_SYSROOT" != x"" ; then
1212
if test -d "$PG_SYSROOT" ; then
1313
CPPFLAGS="-isysroot $PG_SYSROOT $CPPFLAGS"
14+
LDFLAGS="-isysroot $PG_SYSROOT $LDFLAGS"
1415
else
1516
PG_SYSROOT=""
1617
fi

0 commit comments

Comments
 (0)