Skip to content

Commit 39ddbeb

Browse files
committed
ci: fix wrong sysroot in macos 10.15 onwards
In their infinite wisdom, Apple decided that (starting from macOS 10.15 onwards) /usr/include is not the location we should all search in for our beloved C headers. Instead, we should look inside the extremely intuitive and easily guessable new path: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include Because why not.
1 parent 846d386 commit 39ddbeb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/ci/scripts/install-clang.sh

+9
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ if isMacOS; then
1414
ciCommandSetEnv CC "$(pwd)/clang+llvm-9.0.0-x86_64-darwin-apple/bin/clang"
1515
ciCommandSetEnv CXX "$(pwd)/clang+llvm-9.0.0-x86_64-darwin-apple/bin/clang++"
1616

17+
# macOS 10.15 onwards doesn't have libraries in /usr/include anymore: those
18+
# are now located deep into the filesystem, under Xcode's own files. The
19+
# native clang is configured to use the correct path, but our custom one
20+
# doesn't. This sets the SDKROOT environment variable to the SDK so that
21+
# our own clang can figure out the correct include path on its own.
22+
if ! [[ -d "/usr/include" ]]; then
23+
ciCommandSetEnv SDKROOT "$(xcrun --sdk macosx --show-sdk-path)"
24+
fi
25+
1726
# Configure `AR` specifically so rustbuild doesn't try to infer it as
1827
# `clang-ar` by accident.
1928
ciCommandSetEnv AR "ar"

0 commit comments

Comments
 (0)