Skip to content

Commit 8baedb8

Browse files
committed
[compiler-rt] Use xcrun instead of xcodebuild to find the SDK directory
Summary: xcodebuild does not work unless XCode is installed whereas xcrun also work when only the Command Line Tools are installed. Unlike the check for the version (D69610), this did not cause an erro for me since the fallback to /usr/include for the OSX sysroot worked. Reviewers: yln, delcypher Reviewed By: yln Subscribers: dberris, mgorny, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D69659
1 parent 52beec7 commit 8baedb8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function(find_darwin_sdk_dir var sdk_name)
1818
if(NOT DARWIN_PREFER_PUBLIC_SDK)
1919
# Let's first try the internal SDK, otherwise use the public SDK.
2020
execute_process(
21-
COMMAND xcodebuild -version -sdk ${sdk_name}.internal Path
21+
COMMAND xcrun --sdk ${sdk_name}.internal --show-sdk-path
2222
RESULT_VARIABLE result_process
2323
OUTPUT_VARIABLE var_internal
2424
OUTPUT_STRIP_TRAILING_WHITESPACE
@@ -27,7 +27,7 @@ function(find_darwin_sdk_dir var sdk_name)
2727
endif()
2828
if((NOT result_process EQUAL 0) OR "" STREQUAL "${var_internal}")
2929
execute_process(
30-
COMMAND xcodebuild -version -sdk ${sdk_name} Path
30+
COMMAND xcrun --sdk ${sdk_name} --show-sdk-path
3131
RESULT_VARIABLE result_process
3232
OUTPUT_VARIABLE var_internal
3333
OUTPUT_STRIP_TRAILING_WHITESPACE
@@ -39,6 +39,7 @@ function(find_darwin_sdk_dir var sdk_name)
3939
if(result_process EQUAL 0)
4040
set(${var} ${var_internal} PARENT_SCOPE)
4141
endif()
42+
message(STATUS "Checking DARWIN_${sdk_name}_SYSROOT - '${var_internal}'")
4243
set(DARWIN_${sdk_name}_CACHED_SYSROOT ${var_internal} CACHE STRING "Darwin SDK path for SDK ${sdk_name}." FORCE)
4344
endfunction()
4445

compiler-rt/cmake/config-ix.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ if(APPLE)
316316
find_darwin_sdk_dir(DARWIN_tvos_SYSROOT appletvos)
317317

318318
if(NOT DARWIN_osx_SYSROOT)
319+
message(WARNING "Could not determine OS X sysroot, trying /usr/include")
319320
if(EXISTS /usr/include)
320321
set(DARWIN_osx_SYSROOT /)
321322
else()

0 commit comments

Comments
 (0)