Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1aad3a7

Browse files
committed
Yet further rethinking of build changes for macOS Mojave.
The solution arrived at in commite74dd00 presumes that the compilerhas a suitable default -isysroot setting ... but further experienceshows that in many combinations of macOS version, XCode version, Xcodecommand line tools version, and phase of the moon, Apple's compilerwill *not* supply a default -isysroot value.We could potentially go back to the approach used in commit68fc227,but I don't have a lot of faith in the reliability or life expectancy ofthat either. Let's just revert to the approach already shipped in 11.0,namely specifying an -isysroot switch globally. As a partial response tothe concerns raised by Jakob Egger, adjust the contents of Makefile.globalto look likeCPPFLAGS = -isysroot $(PG_SYSROOT) ...PG_SYSROOT = /path/to/sysrootThis allows overriding the sysroot path at build time in a relativelypainless way.Add documentation to installation.sgml about how to use the PG_SYSROOToption. I also took the opportunity to document how to work aroundmacOS's "System Integrity Protection" feature.As before, back-patch to all supported versions.Discussion:https://postgr.es/m/20840.1537850987@sss.pgh.pa.us
1 parent471ae73 commit1aad3a7

File tree

5 files changed

+75
-3
lines changed

5 files changed

+75
-3
lines changed

‎configure

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,7 @@ ac_includes_default="\
642642

643643
ac_subst_vars='LTLIBOBJS
644644
vpath_build
645+
PG_SYSROOT
645646
PG_VERSION_NUM
646647
OSX
647648
XSLTPROC
@@ -31315,6 +31316,15 @@ _ACEOF
3131531316

3131631317

3131731318

31319+
# If we are inserting PG_SYSROOT into CPPFLAGS, do so symbolically not
31320+
# literally, so that it's possible to override it at build time using
31321+
# a command like "make ... PG_SYSROOT=path". This has to be done after
31322+
# we've finished all configure checks that depend on CPPFLAGS.
31323+
if test x"$PG_SYSROOT" != x; then
31324+
CPPFLAGS=`echo "$CPPFLAGS" | sed -e "s| $PG_SYSROOT | \\\$(PG_SYSROOT) |"`
31325+
fi
31326+
31327+
3131831328

3131931329
# Begin output steps
3132031330

‎configure.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2017,6 +2017,15 @@ $AWK '{printf "%d%02d%02d", $1, $2, (NF >= 3) ? $3 : 0}'`"]
20172017
AC_DEFINE_UNQUOTED(PG_VERSION_NUM, $PG_VERSION_NUM, [PostgreSQL version as a number])
20182018
AC_SUBST(PG_VERSION_NUM)
20192019

2020+
# If we are inserting PG_SYSROOT into CPPFLAGS, do so symbolically not
2021+
# literally, so that it's possible to override it at build time using
2022+
# a command like "make ... PG_SYSROOT=path". This has to be done after
2023+
# we've finished all configure checks that depend on CPPFLAGS.
2024+
if test x"$PG_SYSROOT" != x; then
2025+
CPPFLAGS=`echo "$CPPFLAGS" | sed -e "s| $PG_SYSROOT | \\\$(PG_SYSROOT) |"`
2026+
fi
2027+
AC_SUBST(PG_SYSROOT)
2028+
20202029

20212030
# Begin output steps
20222031

‎doc/src/sgml/installation.sgml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2617,6 +2617,57 @@ cc-1020 cc: ERROR File = pqcomm.c, Line = 427
26172617
</para>
26182618
</sect2>
26192619

2620+
<sect2 id="installation-notes-macos">
2621+
<title>macOS</title>
2622+
2623+
<indexterm zone="installation-notes-macos">
2624+
<primary>macOS</primary>
2625+
<secondary>installation on</secondary>
2626+
</indexterm>
2627+
2628+
<para>
2629+
On recent <productname>macOS</productname> releases, it's necessary to
2630+
embed the <quote>sysroot</quote> path in the include switches used to
2631+
find some system header files. This results in the outputs of
2632+
the <application>configure</application> script varying depending on
2633+
which SDK version was used during <application>configure</application>.
2634+
That shouldn't pose any problem in simple scenarios, but if you are
2635+
trying to do something like building an extension on a different machine
2636+
than the server code was built on, you may need to force use of a
2637+
different sysroot path. To do that, set <varname>PG_SYSROOT</varname>,
2638+
for example
2639+
<programlisting>
2640+
make PG_SYSROOT=<replaceable>/desired/path</replaceable> all
2641+
</programlisting>
2642+
To find out the appropriate path on your machine, run
2643+
<programlisting>
2644+
xcodebuild -version -sdk macosx Path
2645+
</programlisting>
2646+
Note that building an extension using a different sysroot version than
2647+
was used to build the core server is not really recommended; in the
2648+
worst case it could result in hard-to-debug ABI inconsistencies.
2649+
</para>
2650+
2651+
<para>
2652+
You can also select a non-default sysroot path when configuring, by
2653+
specifying <varname>PG_SYSROOT</varname>
2654+
to <application>configure</application>:
2655+
<programlisting>
2656+
./configure ... PG_SYSROOT=<replaceable>/desired/path</replaceable>
2657+
</programlisting>
2658+
</para>
2659+
2660+
<para>
2661+
<productname>macOS</productname>'s <quote>System Integrity
2662+
Protection</quote> (SIP) feature breaks <literal>make check</literal>,
2663+
because it prevents passing the needed setting
2664+
of <literal>DYLD_LIBRARY_PATH</literal> down to the executables being
2665+
tested. You can work around that by doing <literal>make
2666+
install</literal> before <literal>make check</literal>.
2667+
Most Postgres developers just turn off SIP, though.
2668+
</para>
2669+
</sect2>
2670+
26202671
<sect2 id="installation-notes-mingw">
26212672
<title>MinGW/Native Windows</title>
26222673

‎src/Makefile.global.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ PTHREAD_LIBS= @PTHREAD_LIBS@
206206

207207
CPP = @CPP@
208208
CPPFLAGS = @CPPFLAGS@
209+
PG_SYSROOT = @PG_SYSROOT@
209210

210211
ifdefPGXS
211212
overrideCPPFLAGS := -I$(includedir_server) -I$(includedir_internal)$(CPPFLAGS)

‎src/template/darwin

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
# Note: Darwin is the original code name for macOS, also known as OS X.
44
# We still use "darwin" as the port name, partly because config.guess does.
55

6-
# Some configure tests require explicit knowledge of where the Xcode "sysroot"
7-
# is. We try to avoid having this leak into configure's results, though.
6+
# Select where system include files should be sought.
87
if test x"$PG_SYSROOT" = x"" ; then
98
PG_SYSROOT=`xcodebuild -version -sdk macosx Path 2>/dev/null`
109
fi
1110
# Old xcodebuild versions may produce garbage, so validate the result.
1211
if test x"$PG_SYSROOT" != x"" ; then
13-
if test \! -d "$PG_SYSROOT" ; then
12+
if test -d "$PG_SYSROOT" ; then
13+
CPPFLAGS="-isysroot $PG_SYSROOT $CPPFLAGS"
14+
else
1415
PG_SYSROOT=""
1516
fi
1617
fi

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp