about summary refs log tree commit diff
path: root/src/ci/scripts/install-clang.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/ci/scripts/install-clang.sh')
-rwxr-xr-xsrc/ci/scripts/install-clang.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/ci/scripts/install-clang.sh b/src/ci/scripts/install-clang.sh
index f0179994e8e..e16a4814197 100755
--- a/src/ci/scripts/install-clang.sh
+++ b/src/ci/scripts/install-clang.sh
@@ -14,6 +14,15 @@ if isMacOS; then
     ciCommandSetEnv CC "$(pwd)/clang+llvm-9.0.0-x86_64-darwin-apple/bin/clang"
     ciCommandSetEnv CXX "$(pwd)/clang+llvm-9.0.0-x86_64-darwin-apple/bin/clang++"
 
+    # macOS 10.15 onwards doesn't have libraries in /usr/include anymore: those
+    # are now located deep into the filesystem, under Xcode's own files. The
+    # native clang is configured to use the correct path, but our custom one
+    # doesn't. This sets the SDKROOT environment variable to the SDK so that
+    # our own clang can figure out the correct include path on its own.
+    if ! [[ -d "/usr/include" ]]; then
+        ciCommandSetEnv SDKROOT "$(xcrun --sdk macosx --show-sdk-path)"
+    fi
+
     # Configure `AR` specifically so rustbuild doesn't try to infer it as
     # `clang-ar` by accident.
     ciCommandSetEnv AR "ar"