pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: James Hilliard <james.hilliard1@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Cc: James Hilliard <james.hilliard1@gmail.com>
Subject: [PATCH 1/1] Fix compilation on mac with Xcode >= 11.4.
Date: Thu, 19 Nov 2020 17:33:14 -0700
Message-ID: <20201120003314.20560-1-james.hilliard1@gmail.com> (raw)

It would appear weak symbol linking is not handled properly without
'isysroot' parameter passed to linker.

Fixes:
Undefined symbols for architecture x86_64:
  "___darwin_check_fd_set_overflow", referenced from:
      _ClientAuthentication in auth.o
      _pgstat_init in pgstat.o
      _ServerLoop in postmaster.o
ld: symbol(s) not found for architecture x86_64

See:
https://github.com/qt/qtwebengine-chromium/commit/d5c4b6230b7f915f6e044e230c0c575249938400
---
 configure           | 4 +++-
 configure.ac        | 4 +++-
 src/template/darwin | 2 ++
 3 files changed, 8 insertions(+), 2 deletions(-)

inline patch 1: configure, configure.ac, src/template/darwin (+8/-2 lines) download inline-1.patchdiff --git a/configure b/configure index ace4ed5dec..92b089907e 100755 --- a/configure +++ b/configure @@ -19041,7 +19041,6 @@ if test "$with_readline" = yes; then else link_test_func=exit fi - if test "$PORTNAME" = "darwin"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wl,-dead_strip_dylibs" >&5 $as_echo_n "checking whether $CC supports -Wl,-dead_strip_dylibs... " >&6; } @@ -19194,6 +19193,9 @@ _ACEOF # we've finished all configure checks that depend on CPPFLAGS. if test x"$PG_SYSROOT" != x; then CPPFLAGS=`echo "$CPPFLAGS" | sed -e "s| $PG_SYSROOT | \\\$(PG_SYSROOT) |"` + if test "$PORTNAME" = "darwin"; then + LDFLAGS=`echo "$LDFLAGS" | sed -e "s| $PG_SYSROOT | \\\$(PG_SYSROOT) |"` + fi fi diff --git a/configure.ac b/configure.ac index 5b91c83fd0..a82cbbc147 100644 --- a/configure.ac +++ b/configure.ac @@ -2326,7 +2326,6 @@ if test "$with_readline" = yes; then else link_test_func=exit fi - if test "$PORTNAME" = "darwin"; then PGAC_PROG_CC_LDFLAGS_OPT([-Wl,-dead_strip_dylibs], $link_test_func) elif test "$PORTNAME" = "openbsd"; then @@ -2362,6 +2361,9 @@ AC_SUBST(PG_VERSION_NUM) # we've finished all configure checks that depend on CPPFLAGS. if test x"$PG_SYSROOT" != x; then CPPFLAGS=`echo "$CPPFLAGS" | sed -e "s| $PG_SYSROOT | \\\$(PG_SYSROOT) |"` + if test "$PORTNAME" = "darwin"; then + LDFLAGS=`echo "$LDFLAGS" | sed -e "s| $PG_SYSROOT | \\\$(PG_SYSROOT) |"` + fi fi AC_SUBST(PG_SYSROOT) diff --git a/src/template/darwin b/src/template/darwin index f4d4e9d7cf..83d20a8cdd 100644 --- a/src/template/darwin +++ b/src/template/darwin @@ -11,6 +11,8 @@ fi if test x"$PG_SYSROOT" != x"" ; then if test -d "$PG_SYSROOT" ; then CPPFLAGS="-isysroot $PG_SYSROOT $CPPFLAGS" + # Prevent undefined symbols errors for weak linked symbols. + LDFLAGS="-isysroot $PG_SYSROOT $LDFLAGS" else PG_SYSROOT="" fi -- 2.29.2

view thread (13+ messages)  latest in thread

Message-ID: <20201120003314.20560-1-james.hilliard1@gmail.com>
Permalink:  ../20201120003314.20560-1-james.hilliard1@gmail.com/
Also on:    postgresql.org/message-id/20201120003314.20560-1-james.hilliard1@gmail.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: james.hilliard1@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: [PATCH 1/1] Fix compilation on mac with Xcode >= 11.4.
  In-Reply-To: <20201120003314.20560-1-james.hilliard1@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox