Doc: improve directions for building on macOS.
authorTom Lane <[email protected]>
Fri, 22 Jan 2021 23:58:25 +0000 (18:58 -0500)
committerTom Lane <[email protected]>
Fri, 22 Jan 2021 23:59:00 +0000 (18:59 -0500)
In light of recent discussions, we should instruct people to
install Apple's command line tools; installing Xcode is secondary.

Also, fix sample command for finding out the default sysroot,
as we now know that the command originally recommended can give
a result that doesn't match your OS version.

Also document the workaround to use if you really don't want
configure to select a sysroot at all.

Discussion: https://postgr.es/m/20210119111625[email protected]

doc/src/sgml/installation.sgml

index 4f9adf429f7fc2c2fa0431854a356e8d947805b2..6b6adf736a5795f8c4a70f087f772d004b020438 100644 (file)
@@ -2549,6 +2549,17 @@ PHSS_30849  s700_800 u2comp/be/plugin library Patch
     <secondary>installation on</secondary>
    </indexterm>
 
+   <para>
+    To build <productname>PostgreSQL</productname> from source
+    on <productname>macOS</productname>, you will need to install Apple's
+    command line developer tools, which can be done by issuing
+<programlisting>
+xcode-select --install
+</programlisting>
+    (note that this will pop up a GUI dialog window for confirmation).
+    You may or may not wish to also install Xcode.
+   </para>
+
    <para>
     On recent <productname>macOS</productname> releases, it's necessary to
     embed the <quote>sysroot</quote> path in the include switches used to
@@ -2565,7 +2576,7 @@ make PG_SYSROOT=<replaceable>/desired/path</replaceable> all
 </programlisting>
     To find out the appropriate path on your machine, run
 <programlisting>
-xcodebuild -version -sdk macosx Path
+xcrun --show-sdk-path
 </programlisting>
     Note that building an extension using a different sysroot version than
     was used to build the core server is not really recommended; in the
@@ -2579,6 +2590,19 @@ xcodebuild -version -sdk macosx Path
 <programlisting>
 ./configure ... PG_SYSROOT=<replaceable>/desired/path</replaceable>
 </programlisting>
+    This would primarily be useful to cross-compile for some other
+    macOS version.  There is no guarantee that the resulting executables
+    will run on the current host.
+   </para>
+
+   <para>
+    To suppress the <option>-isysroot</option> options altogether, use
+<programlisting>
+./configure ... PG_SYSROOT=none
+</programlisting>
+    (any nonexistent pathname will work).  This might be useful if you wish
+    to build with a non-Apple compiler, but beware that that case is not
+    tested or supported by the PostgreSQL developers.
    </para>
 
    <para>