From 46c3c86caa92937d1df37072ece51b522565cd4c Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 7 Mar 2023 22:41:07 +0800 Subject: [PATCH] Parse ld version from `-version_details` --- Library/Homebrew/extend/os/mac/extend/ENV/shared.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/shared.rb b/Library/Homebrew/extend/os/mac/extend/ENV/shared.rb index 6e051bc5b5..31299caf3e 100644 --- a/Library/Homebrew/extend/os/mac/extend/ENV/shared.rb +++ b/Library/Homebrew/extend/os/mac/extend/ENV/shared.rb @@ -26,8 +26,11 @@ module SharedEnvExtension sig { returns(T::Boolean) } def no_fixup_chains_support? - ld_v = Utils.safe_popen_read("/usr/bin/ld", "-v", err: :out).lines.first.chomp - ld_version = Version.parse(ld_v[/\d+(\.\d+)*$/]) + return false if MacOS.version <= :catalina + + # Note: `-version_details` is supported in Xcode 10.2 at the earliest. + ld_version_details = JSON.parse(Utils.safe_popen_read("/usr/bin/ld", "-version_details")) + ld_version = Version.parse(ld_version_details["version"]) # This is supported starting Xcode 13, which ships ld64-711. # https://developer.apple.com/documentation/xcode-release-notes/xcode-13-release-notes