Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gIKLG-0001TD-Sl for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Nov 2018 21:17:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gIKLF-0007QH-8f for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Nov 2018 21:17:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gIKLE-0007GC-Tq for pgsql-hackers@lists.postgresql.org; Thu, 01 Nov 2018 21:17:25 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gIKLC-0000QA-5H for pgsql-hackers@lists.postgresql.org; Thu, 01 Nov 2018 21:17:23 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id wA1LHGrS004845; Thu, 1 Nov 2018 17:17:17 -0400 From: Tom Lane To: Daniel Gustafsson cc: Jakob Egger , pgsql-hackers@lists.postgresql.org Subject: Re: PG vs macOS Mojave In-reply-to: <371F44FD-BCD0-4DD2-A261-346809E3CEE7@yesql.se> References: <20840.1537850987@sss.pgh.pa.us> <29535.1539698523@sss.pgh.pa.us> <486.1539702831@sss.pgh.pa.us> <5BE313A1-1318-4A68-A183-5F60CA968CF1@eggerapps.at> <30776.1539786526@sss.pgh.pa.us> <687EAD19-E8F0-464C-9F2B-BE536B81985E@eggerapps.at> <2429.1539842651@sss.pgh.pa.us> <25039.1539874646@sss.pgh.pa.us> <11941.1541042255@sss.pgh.pa.us> <529860F6-243F-4B6F-B6D6-4376291D1593@yesql.se> <6712.1541081675@sss.pgh.pa.us> <8198.1541083983@sss.pgh.pa.us> <371F44FD-BCD0-4DD2-A261-346809E3CEE7@yesql.se> Comments: In-reply-to Daniel Gustafsson message dated "Thu, 01 Nov 2018 16:01:22 +0100" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <4745.1541106875.0@sss.pgh.pa.us> Date: Thu, 01 Nov 2018 17:17:16 -0400 Message-ID: <4844.1541107036@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4745.1541106875.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable So it seems like there are two ways we could go about this. One is to go back to the scheme of adding an -isysroot switch to CPPFLAGS, where it'd have global effects. We could make this slightly less painful for scenarios like Jakob's if we set things up in Makefile.global this way: CPPFLAGS =3D -isysroot $(PG_SYSROOT) = PG_SYSROOT =3D /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX= .platform/Developer/SDKs/MacOSX10.14.sdk and then, if you need to build on a different SDK version without reconfiguring, you can do something like "make PG_SYSROOT=3D/proper/path". I coded this up, as attached, and it seems to work but it's still not all that friendly for such cases. The other idea that's occurred to me is to go back to the scheme of commit 68fc227dd, where we inject the sysroot path into just the -I switches used for PL/Perl and PL/Tcl. We could improve on that commit by injecting it symbolically similar to what I did here, ie what ends up in the configure output is PG_SYSROOT =3D /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX= .platform/Developer/SDKs/MacOSX10.14.sdk perl_includespec =3D -I $(PG_SYSROOT)/System/Library/Perl/5.18/darwin-thre= ad-multi-2level/CORE Then somebody who wants to build on a different SDK version still needs to do "make PG_SYSROOT=3D/proper/path", but only if they're trying to build PL/Perl or related extensions. So this second way seems uglier in some sense but less likely to cause problems for most people. Either way I guess we'd need to document it rather than just hoping it's invisible. Thoughts? regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="another-try-at-fixing-the-mojave-build.patch"; charset="us-ascii" Content-ID: <4745.1541106875.2@sss.pgh.pa.us> Content-Description: another-try-at-fixing-the-mojave-build.patch Content-Transfer-Encoding: quoted-printable diff --git a/configure b/configure index 43ae8c8..0686941 100755 *** a/configure --- b/configure *************** ac_includes_default=3D"\ *** 627,632 **** --- 627,633 ---- = ac_subst_vars=3D'LTLIBOBJS vpath_build + PG_SYSROOT PG_VERSION_NUM PROVE FOP *************** _ACEOF *** 18815,18820 **** --- 18816,18830 ---- = = = + # If we are inserting PG_SYSROOT into CPPFLAGS, do so symbolically not + # literally, so that it's possible to override it at build time using + # a command like "make ... PG_SYSROOT=3Dpath". This has to be done afte= r + # we've finished all configure checks that depend on CPPFLAGS. + if test x"$PG_SYSROOT" !=3D x; then + CPPFLAGS=3D`echo "$CPPFLAGS" | sed -e "s| $PG_SYSROOT | \\\$(PG_SYSROO= T) |"` + fi + = + = = # Begin output steps = diff --git a/configure.in b/configure.in index 519ecd5..7586deb 100644 *** a/configure.in --- b/configure.in *************** $AWK '{printf "%d%04d", $1, $2}'`"] *** 2357,2362 **** --- 2357,2371 ---- AC_DEFINE_UNQUOTED(PG_VERSION_NUM, $PG_VERSION_NUM, [PostgreSQL version = as a number]) AC_SUBST(PG_VERSION_NUM) = + # If we are inserting PG_SYSROOT into CPPFLAGS, do so symbolically not + # literally, so that it's possible to override it at build time using + # a command like "make ... PG_SYSROOT=3Dpath". This has to be done afte= r + # we've finished all configure checks that depend on CPPFLAGS. + if test x"$PG_SYSROOT" !=3D x; then + CPPFLAGS=3D`echo "$CPPFLAGS" | sed -e "s| $PG_SYSROOT | \\\$(PG_SYSROO= T) |"` + fi + AC_SUBST(PG_SYSROOT) + = = # Begin output steps = diff --git a/src/Makefile.global.in b/src/Makefile.global.in index bdf394b..218c65a 100644 *** a/src/Makefile.global.in --- b/src/Makefile.global.in *************** BITCODE_CXXFLAGS =3D @BITCODE_CXXFLAGS@ *** 241,246 **** --- 241,247 ---- = CPP =3D @CPP@ CPPFLAGS =3D @CPPFLAGS@ + PG_SYSROOT =3D @PG_SYSROOT@ = override CPPFLAGS :=3D $(ICU_CFLAGS) $(CPPFLAGS) = diff --git a/src/template/darwin b/src/template/darwin index 159d8bb..c05adca 100644 *** a/src/template/darwin --- b/src/template/darwin *************** *** 3,16 **** # Note: Darwin is the original code name for macOS, also known as OS X. # We still use "darwin" as the port name, partly because config.guess do= es. = ! # Some configure tests require explicit knowledge of where the Xcode "sy= sroot" ! # is. We try to avoid having this leak into configure's results, though= . if test x"$PG_SYSROOT" =3D x"" ; then PG_SYSROOT=3D`xcodebuild -version -sdk macosx Path 2>/dev/null` fi # Old xcodebuild versions may produce garbage, so validate the result. if test x"$PG_SYSROOT" !=3D x"" ; then ! if test \! -d "$PG_SYSROOT" ; then PG_SYSROOT=3D"" fi fi --- 3,17 ---- # Note: Darwin is the original code name for macOS, also known as OS X. # We still use "darwin" as the port name, partly because config.guess do= es. = ! # Select where system include files should be sought. if test x"$PG_SYSROOT" =3D x"" ; then PG_SYSROOT=3D`xcodebuild -version -sdk macosx Path 2>/dev/null` fi # Old xcodebuild versions may produce garbage, so validate the result. if test x"$PG_SYSROOT" !=3D x"" ; then ! if test -d "$PG_SYSROOT" ; then ! CPPFLAGS=3D"-isysroot $PG_SYSROOT $CPPFLAGS" ! else PG_SYSROOT=3D"" fi fi ------- =_aaaaaaaaaa0--