From 743b0617b973f76b20860a5c7e7a1d91c2750b3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Tue, 18 Oct 2022 19:31:14 +0100 Subject: [PATCH] Also automatically detect macOS version and SDK --- base/loading.jl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/base/loading.jl b/base/loading.jl index c6cf12c46f331d..96f4a2320b53ff 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -1784,9 +1784,13 @@ function ld() elseif Sys.isapple() flavor = "darwin" arch = Sys.ARCH == :aarch64 ? :arm64 : Sys.ARCH - # TODO: gently handle failure in `xcrun` (command not found, garbage being returned, etc...) + # TODO: gently handle failure in `xcrun`/`sw_vers` (command not found, garbage being + # returned, etc...). We probably also want to provide ways to override platform + # version and SDK, for when we build the release binaries. sysroot = readchomp(`xcrun --sdk macosx --show-sdk-path`) - default_args = `-arch $arch -syslibroot $(sysroot) -lSystem -platform_version macos 10 11` + platform_version = readchomp(`sw_vers -productVersion`) + platform_sdk = readchomp(`xcrun --show-sdk-version`) + default_args = `-arch $arch -syslibroot $(sysroot) -lSystem -platform_version macos $(platform_version) $(platform_sdk)` else flavor = "gnu" end