Open maleadt opened 1 month ago
Looks like this is hard-coded in the build by Homebrew through -DDEFAULT_SYSROOT
: https://github.com/Homebrew/homebrew-core/blob/753cb488e0c6ad28b1f123a8c2a3b9c0337193bd/Formula/l/llvm%4015.rb#L134
... where macos_sdk
comes from MacOS.sdk_path_if_needed
:
❯ brew ruby -e 'puts MacOS.sdk_path_if_needed'
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk
Yeah, you need to pass the path to the SDK with something like
-syslibroot $(xcrun --sdk macosx --show-sdk-path)
see the thread at https://github.com/JuliaLang/julia/pull/47184#discussion_r998380466
Right, I guess I'm arguing that we should configure this by default by setting DEFAULT_SYSROOT
. Otherwise Clang_jll is pretty useless without this additional flag, which may not always be easy to set (e.g., POCL_jll is also broken because of this: https://github.com/pocl/pocl/issues/1530). Or is that not possible?
I'm not sure ww can set a default sysroot path, because it depends on the macos version. I guess in homebrew they can do it because their packages are macos version-specific.
The primary user of Clang_jll is Clang.jl which uses https://github.com/JuliaInterop/Clang.jl/blob/5e75b5f1b5321c33e6b5ece9cdf05b7e5b325f24/src/generator/context.jl#L243-L245 and https://github.com/JuliaInterop/Clang.jl/blob/5e75b5f1b5321c33e6b5ece9cdf05b7e5b325f24/src/platform/system.jl#L56 but interestingly no isysroot
.
In ClangCompiler.jl we did end up setting it https://github.com/Gnimuc/ClangCompiler.jl/blob/acde0348968aae4afad4513fe08c22f611db0d59/examples/clang-interpreter/interpreter.jl#L32
I'm not sure ww can set a default sysroot path, because it depends on the macos version.
There is a symlink:
❯ ls -lah /Library/Developer/CommandLineTools/SDKs
total 0
drwxr-xr-x 7 root wheel 224B Mar 8 14:18 .
drwxr-xr-x 5 root wheel 160B Dec 11 2023 ..
lrwxr-xr-x 1 root wheel 14B Mar 8 14:17 MacOSX.sdk -> MacOSX14.4.sdk
drwxr-xr-x 7 root wheel 224B Mar 8 14:18 MacOSX13.3.sdk
lrwxr-xr-x 1 root wheel 14B Mar 8 14:17 MacOSX13.sdk -> MacOSX13.3.sdk
drwxr-xr-x 7 root wheel 224B Feb 20 01:28 MacOSX14.4.sdk
lrwxr-xr-x 1 root wheel 14B Mar 8 14:16 MacOSX14.sdk -> MacOSX14.4.sdk
This raises a question I always had. Could we do "CI" for our jlls? Right now we are doing verification, but I have always been hesitating to recommend using clang from Clang_jll since we do no work to verify that it is functional for C/C++.
I could just paper over this by setting SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
in pocl_jll.jl's init function, but that feels icky.
Yeah this reminded me of https://github.com/JuliaPackaging/BinaryBuilder.jl/issues/687
I often have something like: https://github.com/JuliaParallel/PMIx.jl/blob/b5c6be4fe342bae7fc6ee770e1e5cc9d388ceab1/src/api.jl#L11
We do know how have https://github.com/JuliaPackaging/BinaryBuilder.jl/pull/791 but that is a similar level of icky
With verbosity cranked up:
math.h
is located in/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include
, which is only discovered by the system Clang.Looks like this is related to sysroot discovery; adding
-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk
or definingSDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk
"fixes" the issue.