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 1gILDm-0003nS-Gl for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Nov 2018 22:13:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gILDj-0001ZW-U0 for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Nov 2018 22:13:43 +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 1gILDj-0001ZP-Iv for pgsql-hackers@lists.postgresql.org; Thu, 01 Nov 2018 22:13:43 +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 1gILDg-0001fx-QK for pgsql-hackers@lists.postgresql.org; Thu, 01 Nov 2018 22:13:42 +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 wA1MDbVh008454; Thu, 1 Nov 2018 18:13:37 -0400 From: Tom Lane To: Peter Eisentraut cc: Daniel Gustafsson , Jakob Egger , pgsql-hackers@lists.postgresql.org Subject: Re: PG vs macOS Mojave In-reply-to: <8164.1541110113@sss.pgh.pa.us> 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> <4844.1541107036@sss.pgh.pa.us> <8164.1541110113@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Thu, 01 Nov 2018 18:08:33 -0400" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <8439.1541110397.0@sss.pgh.pa.us> Date: Thu, 01 Nov 2018 18:13:37 -0400 Message-ID: <8453.1541110417@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: <8439.1541110397.1@sss.pgh.pa.us> I wrote: > Peter Eisentraut writes: >> On 01/11/2018 22:17, Tom Lane wrote: >>> 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 >> How does that work when building against a non-system Perl or Tcl? > It does nothing, because configure will not find that it needs to > inject any sysroot reference in order to find such a Perl or Tcl's > headers. Here's a lightly-tested patch for that approach. regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="other-way-to-fix-mojave-build.patch"; charset="us-ascii" Content-ID: <8439.1541110397.2@sss.pgh.pa.us> Content-Description: other-way-to-fix-mojave-build.patch Content-Transfer-Encoding: quoted-printable diff --git a/configure b/configure index 43ae8c8..db50751 100755 *** a/configure --- b/configure *************** CPP *** 731,736 **** --- 731,737 ---- BITCODE_CXXFLAGS BITCODE_CFLAGS CFLAGS_VECTOR + PG_SYSROOT LLVM_BINPATH LLVM_CXXFLAGS LLVM_CFLAGS *************** unset CXXFLAGS *** 5261,5266 **** --- 5262,5270 ---- # . "$srcdir/src/template/$template" || exit = + # Record PG_SYSROOT in Makefile.global, if set by user or template. + = + = # C[XX]FLAGS are selected so: # If the user specifies something in the environment, that is used. # else: If the template file set something, that is used. *************** PL/Perl." "$LINENO" 5 *** 9776,9786 **** fi # On most platforms, archlibexp is also where the Perl include files l= ive ... perl_includespec=3D"-I$perl_archlibexp/CORE" ! # ... but on newer macOS versions, we must use -iwithsysroot to look ! # under $PG_SYSROOT if test \! -f "$perl_archlibexp/CORE/perl.h" ; then if test -f "$PG_SYSROOT$perl_archlibexp/CORE/perl.h" ; then ! perl_includespec=3D"-iwithsysroot $perl_archlibexp/CORE" fi fi = --- 9780,9789 ---- fi # On most platforms, archlibexp is also where the Perl include files l= ive ... perl_includespec=3D"-I$perl_archlibexp/CORE" ! # ... but on newer macOS versions, we must look under $PG_SYSROOT inst= ead if test \! -f "$perl_archlibexp/CORE/perl.h" ; then if test -f "$PG_SYSROOT$perl_archlibexp/CORE/perl.h" ; then ! perl_includespec=3D"-I$PG_SYSROOT$perl_archlibexp/CORE" fi fi = *************** eval TCL_SHARED_BUILD=3D\"$TCL_SHARED_BUIL *** 18115,18120 **** --- 18118,18128 ---- as_fn_error $? "cannot build PL/Tcl because Tcl is not a shared li= brary Use --without-tcl to disable building PL/Tcl." "$LINENO" 5 fi + # Some macOS versions report an include spec that uses -iwithsysroot= . + # We don't really want to use -isysroot, so translate that if we can= . + if test x"$PG_SYSROOT" !=3D x; then + TCL_INCLUDE_SPEC=3D"`echo "$TCL_INCLUDE_SPEC" | sed "s|-iwithsys= root */|-I$PG_SYSROOT/|"`" + fi # now that we have TCL_INCLUDE_SPEC, we can check for ac_save_CPPFLAGS=3D$CPPFLAGS CPPFLAGS=3D"$TCL_INCLUDE_SPEC $CPPFLAGS" *************** fi *** 18127,18132 **** --- 18135,18147 ---- = = CPPFLAGS=3D$ac_save_CPPFLAGS + # If we are inserting PG_SYSROOT into TCL_INCLUDE_SPEC, do so symbol= ically + # 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 af= ter we've + # finished all configure checks that depend on TCL_INCLUDE_SPEC. + if test x"$PG_SYSROOT" !=3D x; then + TCL_INCLUDE_SPEC=3D`echo "$TCL_INCLUDE_SPEC" | sed -e "s|-I$PG_SYS= ROOT/|-I\\\$(PG_SYSROOT)/|"` + fi fi = # check for *************** rm -f core conftest.err conftest.$ac_obj *** 18176,18181 **** --- 18191,18203 ---- conftest$ac_exeext conftest.$ac_ext LIBS=3D$pgac_save_LIBS CPPFLAGS=3D$ac_save_CPPFLAGS + # If we are inserting PG_SYSROOT into perl_includespec, do so symbolic= ally + # not literally, so that it's possible to override it at build time us= ing a + # command like "make ... PG_SYSROOT=3Dpath". This has to be done afte= r we've + # finished all configure checks that depend on perl_includespec. + if test x"$PG_SYSROOT" !=3D x; then + perl_includespec=3D`echo "$perl_includespec" | sed -e "s|-I$PG_SYSRO= OT/|-I\\\$(PG_SYSROOT)/|"` + fi fi = # check for diff --git a/configure.in b/configure.in index 519ecd5..b895f7d 100644 *** a/configure.in --- b/configure.in *************** unset CXXFLAGS *** 404,409 **** --- 404,412 ---- # . "$srcdir/src/template/$template" || exit = + # Record PG_SYSROOT in Makefile.global, if set by user or template. + AC_SUBST(PG_SYSROOT) + = # C[XX]FLAGS are selected so: # If the user specifies something in the environment, that is used. # else: If the template file set something, that is used. *************** PL/Perl.]) *** 1046,1056 **** fi # On most platforms, archlibexp is also where the Perl include files l= ive ... perl_includespec=3D"-I$perl_archlibexp/CORE" ! # ... but on newer macOS versions, we must use -iwithsysroot to look ! # under $PG_SYSROOT if test \! -f "$perl_archlibexp/CORE/perl.h" ; then if test -f "$PG_SYSROOT$perl_archlibexp/CORE/perl.h" ; then ! perl_includespec=3D"-iwithsysroot $perl_archlibexp/CORE" fi fi AC_SUBST(perl_includespec)dnl --- 1049,1058 ---- fi # On most platforms, archlibexp is also where the Perl include files l= ive ... perl_includespec=3D"-I$perl_archlibexp/CORE" ! # ... but on newer macOS versions, we must look under $PG_SYSROOT inst= ead if test \! -f "$perl_archlibexp/CORE/perl.h" ; then if test -f "$PG_SYSROOT$perl_archlibexp/CORE/perl.h" ; then ! perl_includespec=3D"-I$PG_SYSROOT$perl_archlibexp/CORE" fi fi AC_SUBST(perl_includespec)dnl *************** if test "$with_tcl" =3D yes; then *** 2212,2222 **** --- 2214,2236 ---- AC_MSG_ERROR([cannot build PL/Tcl because Tcl is not a shared libr= ary Use --without-tcl to disable building PL/Tcl.]) fi + # Some macOS versions report an include spec that uses -iwithsysroot= . + # We don't really want to use -isysroot, so translate that if we can= . + if test x"$PG_SYSROOT" !=3D x; then + TCL_INCLUDE_SPEC=3D"`echo "$TCL_INCLUDE_SPEC" | sed "s|-iwithsys= root */|-I$PG_SYSROOT/|"`" + fi # now that we have TCL_INCLUDE_SPEC, we can check for ac_save_CPPFLAGS=3D$CPPFLAGS CPPFLAGS=3D"$TCL_INCLUDE_SPEC $CPPFLAGS" AC_CHECK_HEADER(tcl.h, [], [AC_MSG_ERROR([header file is req= uired for Tcl])]) CPPFLAGS=3D$ac_save_CPPFLAGS + # If we are inserting PG_SYSROOT into TCL_INCLUDE_SPEC, do so symbol= ically + # 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 af= ter we've + # finished all configure checks that depend on TCL_INCLUDE_SPEC. + if test x"$PG_SYSROOT" !=3D x; then + TCL_INCLUDE_SPEC=3D`echo "$TCL_INCLUDE_SPEC" | sed -e "s|-I$PG_SYS= ROOT/|-I\\\$(PG_SYSROOT)/|"` + fi fi = # check for *************** if test "$with_perl" =3D yes; then *** 2241,2246 **** --- 2255,2267 ---- AC_MSG_ERROR([libperl library is required for Perl])]) LIBS=3D$pgac_save_LIBS CPPFLAGS=3D$ac_save_CPPFLAGS + # If we are inserting PG_SYSROOT into perl_includespec, do so symbolic= ally + # not literally, so that it's possible to override it at build time us= ing a + # command like "make ... PG_SYSROOT=3Dpath". This has to be done afte= r we've + # finished all configure checks that depend on perl_includespec. + if test x"$PG_SYSROOT" !=3D x; then + perl_includespec=3D`echo "$perl_includespec" | sed -e "s|-I$PG_SYSRO= OT/|-I\\\$(PG_SYSROOT)/|"` + fi fi = # check for diff --git a/src/Makefile.global.in b/src/Makefile.global.in index bdf394b..2f8c869 100644 *** a/src/Makefile.global.in --- b/src/Makefile.global.in *************** host_tuple =3D @host@ *** 496,501 **** --- 496,504 ---- host_os =3D @host_os@ host_cpu =3D @host_cpu@ = + # On macOS, we may need to find include files here + PG_SYSROOT =3D @PG_SYSROOT@ + = # Make HAVE_IPV6 available for initdb script creation HAVE_IPV6=3D @HAVE_IPV6@ = diff --git a/src/template/darwin b/src/template/darwin index 159d8bb..7022733 100644 *** a/src/template/darwin --- b/src/template/darwin *************** *** 3,10 **** # 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 --- 3,11 ---- # 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 some include files should be sought. ! # We may eventually be forced to use "-isysroot" with this value, ! # but for now, it only affects Perl and Tcl include files. if test x"$PG_SYSROOT" =3D x"" ; then PG_SYSROOT=3D`xcodebuild -version -sdk macosx Path 2>/dev/null` fi ------- =_aaaaaaaaaa0--