Skip to content

Commit

Permalink
Automatically detect macOS SDK path and fix linker flags
Browse files Browse the repository at this point in the history
  • Loading branch information
giordano committed Oct 18, 2022
1 parent 00a82c4 commit d3ecb28
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1784,7 +1784,9 @@ function ld()
elseif Sys.isapple()
flavor = "darwin"
arch = Sys.ARCH == :aarch64 ? :arm64 : Sys.ARCH
default_args = `-arch $arch -lSystem -L/usr/lib -platform_version macos 10 11`
# TODO: gently handle failure in `xcrun` (command not found, garbage being returned, etc...)
sysroot = readchomp(`xcrun --sdk macosx --show-sdk-path`)
default_args = `-arch $arch -syslibroot $(sysroot) -lSystem -platform_version macos 10 11`
else
flavor = "gnu"
end
Expand Down Expand Up @@ -1834,9 +1836,9 @@ end

function l(path)
@static if Sys.iswindows()
`$path`
path
else
`-l$path`
"-l$path"
end
end

Expand Down

0 comments on commit d3ecb28

Please sign in to comment.