PG vs macOS Mojave
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Date: 2018-09-25T04:49:47Z
Lists: pgsql-hackers
Attachments
- fixups-for-mojave-1.patch (text/x-diff) patch
Well, macOS 10.14 (Mojave) is out, so I installed it on a spare machine, and naturally the first thing I tried was to build PG with it. Our core code seems fine, but: * --with-perl fails in configure, complaining that it can't find perl.h. * --with-tcl fails in configure, complaining that it can't find tclConfig.sh. Furthermore, the historical workaround for that (--with-tclconfig=/System/Library/Frameworks/Tcl.framework) doesn't fix it. After some investigation, it seems that Apple has been busy moving header files (not libraries) under SDK-specific "sysroot" directories, with the expectation that you'd compile using "-isysroot $SYSROOT". There's some mention of that here, for example: https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html#//apple_ref/doc/uid/10000163i-CH1-SW7 The sysroot seems to contain only headers; stuff you need at runtime, such as shared libraries, is still where it used to be. The recommended way to get the appropriate sysroot path seems to be SYSROOT=`xcodebuild -version -sdk macosx Path` Attached is a draft patch to fix things up. The core ideas are (1) Stop assuming that the Perl headers and library are necessarily in the same place; create a perl_includedir variable to represent the path to the former. (2) Tweak src/template/darwin to inject the appropriate -isysroot option into CPPFLAGS. (3) Remove the need to manually specify the path to tclConfig.sh, which has gotten even more painful than before because now it's somewhere under the sysroot. You can still specify --with-tclconfig if you really want to, but it's not necessary anymore to build pltcl under recent macOS. Note that (3) alone is not sufficient to fix pltcl; we must do (2) as well because tclConfig.sh now reports the Tcl include flags as TCL_INCLUDE_SPEC = -iwithsysroot /System/Library/Frameworks/Tcl.framework/Versions/8.5/Headers so unless we also set -isysroot this doesn't work. It's a bit scary to be adding -isysroot globally. I thought briefly about using it only while building pltcl, but that seems even more dangerous: if there were any discrepancies between the headers in the sysroot and those in the normal include directories, building pltcl with different headers from the rest of the system would surely be disastrous. In any case, I suspect that the handwriting is on the wall, and before very much longer it's going to be impossible to build meaningful code on macOS without -isysroot anyway. I've tested this on all the macOS versions I have at hand, and it doesn't seem to break anything. Only part (1) could possibly affect other platforms, and that seems safe enough. I'd like to commit and backpatch this, because otherwise longfin is going to start falling over when I upgrade its host to Mojave. Thoughts? regards, tom lane
Commits
-
Yet further rethinking of build changes for macOS Mojave.
- df1d749a7bda 11.1 landed
- 94ea1cf73183 9.5.15 landed
- 401202b7988c 9.6.11 landed
- 229a5c8ade48 10.6 landed
- 1b5e8b408eb9 9.4.20 landed
- 1aad3a724a40 9.3.25 landed
- 1440c461f7ea 12.0 landed
-
Still further rethinking of build changes for macOS Mojave.
- e74dd00f53cd 12.0 landed
- d1e869d1ef1c 11.1 landed
- 34f9944c207f 10.6 landed
- 1b92ca9e2c22 9.6.11 landed
- 0749acca50d3 9.4.20 landed
- 021b355cd166 9.5.15 landed
- 015fd381fe4e 9.3.25 landed
-
Back off using -isysroot on Darwin.
- ee6c08b01b9b 10.6 landed
- d0ab588cc836 9.5.15 landed
- 68fc227dd073 12.0 landed
- 5777a9ff8f21 9.6.11 landed
- 486e6f8d9c78 9.4.20 landed
- 1a69f738d25f 11.1 landed
- 19ac2cb2ae51 9.3.25 landed
-
Make some fixes to allow building Postgres on macOS 10.14 ("Mojave").
- 5e22171310f8 12.0 cited