When building on macOS against a Homebrew-provided Perl installation, I get these warnings during the build:

ld: warning: object file (SPI.o) was built for newer macOS version (12.4) than being linked (11.3) ld: warning: object file (plperl.o) was built for newer macOS version (12.4) than being linked (11.3)
...

This is because the link command uses the option -mmacosx-version-min=11.3, which comes in from perl_embed_ldflags (perl -MExtUtils::Embed -e ldopts), but the compile commands don't use that option, which creates a situation that ld considers inconsistent.

I think an appropriate fix is to strip out the undesired option from perl_embed_ldflags. We already do that for other options. Proposed patch attached.
From e50c439f2fced8d1b3af9b3bc142f8d43a781c5a Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Thu, 18 Aug 2022 08:24:03 +0200
Subject: [PATCH] Strip -mmacosx-version-min options from plperl build

---
 config/perl.m4 | 2 +-
 configure      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/config/perl.m4 b/config/perl.m4
index c823fc8cf0..65f338bda7 100644
--- a/config/perl.m4
+++ b/config/perl.m4
@@ -100,7 +100,7 @@ if test "$PORTNAME" = "win32" ; then
 else
        pgac_tmp1=`$PERL -MExtUtils::Embed -e ldopts`
        pgac_tmp2=`$PERL -MConfig -e 'print $Config{ccdlflags}'`
-       perl_embed_ldflags=`echo X"$pgac_tmp1" | sed -e "s/^X//" -e 
"s%$pgac_tmp2%%" -e ["s/ -arch [-a-zA-Z0-9_]*//g"]`
+       perl_embed_ldflags=`echo X"$pgac_tmp1" | sed -e "s/^X//" -e 
"s%$pgac_tmp2%%" -e ["s/ -arch [-a-zA-Z0-9_]*//g"] -e ["s/ 
-mmacosx-version-min=[0-9.]*//g"]`
 fi
 AC_SUBST(perl_embed_ldflags)dnl
 if test -z "$perl_embed_ldflags" ; then
diff --git a/configure b/configure
index 176e0f9b00..8e0f648702 100755
--- a/configure
+++ b/configure
@@ -10479,7 +10479,7 @@ if test "$PORTNAME" = "win32" ; then
 else
        pgac_tmp1=`$PERL -MExtUtils::Embed -e ldopts`
        pgac_tmp2=`$PERL -MConfig -e 'print $Config{ccdlflags}'`
-       perl_embed_ldflags=`echo X"$pgac_tmp1" | sed -e "s/^X//" -e 
"s%$pgac_tmp2%%" -e "s/ -arch [-a-zA-Z0-9_]*//g"`
+       perl_embed_ldflags=`echo X"$pgac_tmp1" | sed -e "s/^X//" -e 
"s%$pgac_tmp2%%" -e "s/ -arch [-a-zA-Z0-9_]*//g" -e "s/ 
-mmacosx-version-min=[0-9.]*//g"`
 fi
 if test -z "$perl_embed_ldflags" ; then
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-- 
2.37.1

Reply via email to