From 60f1e11008718ec5befd2a35e8fa2af0a5e92a43 Mon Sep 17 00:00:00 2001 From: Sevan Janiyan Date: Sun, 27 Apr 2025 21:07:43 +0100 Subject: [PATCH 1/4] hints/darwin.sh: skip ldflags in lddlflags It has not effect. "adopting flags from ldflags is supposed to happen in Configure, not in hints." - leont Configuring a build of perl with -Aappend:ldflags=" -L/var/empty" and checking the output of 'perl -V:ldflags -V:lddlflags' shows ldflags=' -L/var/empty'; lddlflags='-bundle -undefined dynamic_lookup -L/var/empty'; Found when analysing issue #9437 Tested on OS X 10.4 aka Darwin 8. --- hints/darwin.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hints/darwin.sh b/hints/darwin.sh index 9267791417e9..e889824b7c09 100644 --- a/hints/darwin.sh +++ b/hints/darwin.sh @@ -277,18 +277,18 @@ add_macosx_version_min () { # But starting from perl 5.8.1/Darwin 7 the default is the two-level. case "$osvers" in # Note: osvers is the kernel version, not the 10.x 1.[0-3].*) # OS X 10.0.x - lddlflags="${ldflags} -bundle -undefined suppress" + lddlflags="-bundle -undefined suppress" ;; 1.*) # OS X 10.1 ldflags="${ldflags} -flat_namespace" - lddlflags="${ldflags} -bundle -undefined suppress" + lddlflags="-bundle -undefined suppress" ;; [2-6].*) # OS X 10.1.x - 10.2.x (though [2-4] never existed publicly) ldflags="${ldflags} -flat_namespace" - lddlflags="${ldflags} -bundle -undefined suppress" + lddlflags="-bundle -undefined suppress" ;; [7-8].*) # OS X 10.3.x - 10.4.x - lddlflags="${ldflags} -bundle -undefined dynamic_lookup" + lddlflags="-bundle -undefined dynamic_lookup" case "$ld" in *MACOSX_DEPLOYMENT_TARGET*) ;; *) ld="env MACOSX_DEPLOYMENT_TARGET=10.3 ${ld}" ;; @@ -357,7 +357,7 @@ EOM esac fi - lddlflags="${ldflags} -bundle -undefined dynamic_lookup" + lddlflags="-bundle -undefined dynamic_lookup" ;; esac From b64a203a39430d86639bd6959369856fbce78e7d Mon Sep 17 00:00:00 2001 From: Sevan Janiyan Date: Tue, 29 Apr 2025 15:11:13 +0100 Subject: [PATCH 2/4] hints/darwin.sh: define $lddlflags earlier So it can be appended, otherwise it just hardcodes lddlflags="-bundle -undefined dynamic_lookup" Make sure MACOSX_DEPLOYMENT_TARGET is added to $lddlflags. --- hints/darwin.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hints/darwin.sh b/hints/darwin.sh index e889824b7c09..5f91f3aadea5 100644 --- a/hints/darwin.sh +++ b/hints/darwin.sh @@ -295,6 +295,7 @@ case "$osvers" in # Note: osvers is the kernel version, not the 10.x esac ;; *) # OS X 10.5.x - current + lddlflags="-bundle -undefined dynamic_lookup" # The MACOSX_DEPLOYMENT_TARGET is not needed, # but the -mmacosx-version-min option is always used. @@ -304,6 +305,7 @@ case "$osvers" in # Note: osvers is the kernel version, not the 10.x [1-9][0-9].*) add_macosx_version_min ccflags $MACOSX_DEPLOYMENT_TARGET add_macosx_version_min ldflags $MACOSX_DEPLOYMENT_TARGET + add_macosx_version_min lddlflags $MACOSX_DEPLOYMENT_TARGET ;; '') # Empty MACOSX_DEPLOYMENT_TARGET is okay. @@ -357,7 +359,6 @@ EOM esac fi - lddlflags="-bundle -undefined dynamic_lookup" ;; esac From de58058df30396fed8dd4bab1446ab6b97609fbc Mon Sep 17 00:00:00 2001 From: Sevan Janiyan Date: Tue, 29 Apr 2025 15:37:11 +0100 Subject: [PATCH 3/4] hints/darwin.sh: hint at newer OS' Need to be explicit with OS' for macOS 11 and up here. Otherwise: Unexpected MACOSX_DEPLOYMENT_TARGET=11 --- hints/darwin.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hints/darwin.sh b/hints/darwin.sh index 5f91f3aadea5..127085c5a6bf 100644 --- a/hints/darwin.sh +++ b/hints/darwin.sh @@ -315,7 +315,7 @@ case "$osvers" in # Note: osvers is the kernel version, not the 10.x *** Unexpected MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET *** -*** Please either set it to a valid macOS version number (e.g., 10.15) or to empty. +*** Please either set it to a valid macOS version number (e.g., 10.15 or 11.0) or to empty. EOM exit 1 From d7cce54fdb74b857881a9c07915d9134a0659b05 Mon Sep 17 00:00:00 2001 From: Sevan Janiyan Date: Tue, 29 Apr 2025 15:53:10 +0100 Subject: [PATCH 4/4] hints/darwin.sh: drop $prodvers Unless MACOSX_DEPLOYMENT_TARGET is passed into the build, just ride the defaults of the OS' toolchain. This code assumes OS X versioning (10.15.x ) and tries to drop the patch version from the product version so that you're targetting macOS 10.15, rather than 10.15.1. Unfortunately with macOS 11 and up, it ends up targetting the patch version and since we're no longer appending $ld to $lddlflags we end up with the core targetting the major version and the modules targetting the patch version. Resulting in warnings ld: warning: object file (/Users/runner/work/perl5/perl5/cpan/Compress-Raw-Bzip2/Bzip2.o) was built for newer 'macOS' version (14.7) than being linked (14.0) --- hints/darwin.sh | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/hints/darwin.sh b/hints/darwin.sh index 127085c5a6bf..b9c8a88d9b8c 100644 --- a/hints/darwin.sh +++ b/hints/darwin.sh @@ -322,28 +322,6 @@ EOM ;; esac - # Keep the prodvers leading whitespace (Configure magic). - # Cannot use $osvers here since that is the kernel version. - # sw_vers output what we want - # "ProductVersion: 10.10.5" "10.10" - # "ProductVersion: 10.11" "10.11" - prodvers=`sw_vers|awk '/^ProductVersion:/{print $2}'|awk -F. '{print $1"."$2}'` - case "$prodvers" in - [1-9][0-9].*) - add_macosx_version_min ccflags $prodvers - add_macosx_version_min ldflags $prodvers - ;; - *) - cat <&4 - -*** Unexpected product version $prodvers. -*** -*** Try running sw_vers and see what its ProductVersion says. - -EOM - exit 1 - esac - darwin_major=$(echo $osvers|awk -F. '{print $1}') # macOS 10.12 (darwin 16.0.0) deprecated syscall().