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.
This commit is contained in:
Pietro Albini 2019-12-11 11:06:40 +01:00
parent 846d386b4d
commit 39ddbeb874
No known key found for this signature in database
GPG key ID: 3E06ABE80BAAF19C

View file

@ -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"