Skip to content

Commit 771499d

Browse files
arichardsondelcypher
authored andcommitted
[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 (cherry picked from commit 8baedb8)
1 parent 8beb230 commit 771499d

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
@@ -15,7 +15,7 @@ function(find_darwin_sdk_dir var sdk_name)
1515
if(NOT DARWIN_PREFER_PUBLIC_SDK)
1616
# Let's first try the internal SDK, otherwise use the public SDK.
1717
execute_process(
18-
COMMAND xcodebuild -version -sdk ${sdk_name}.internal Path
18+
COMMAND xcrun --sdk ${sdk_name}.internal --show-sdk-path
1919
RESULT_VARIABLE result_process
2020
OUTPUT_VARIABLE var_internal
2121
OUTPUT_STRIP_TRAILING_WHITESPACE
@@ -24,7 +24,7 @@ function(find_darwin_sdk_dir var sdk_name)
2424
endif()
2525
if((NOT result_process EQUAL 0) OR "" STREQUAL "${var_internal}")
2626
execute_process(
27-
COMMAND xcodebuild -version -sdk ${sdk_name} Path
27+
COMMAND xcrun --sdk ${sdk_name} --show-sdk-path
2828
RESULT_VARIABLE result_process
2929
OUTPUT_VARIABLE var_internal
3030
OUTPUT_STRIP_TRAILING_WHITESPACE
@@ -36,6 +36,7 @@ function(find_darwin_sdk_dir var sdk_name)
3636
if(result_process EQUAL 0)
3737
set(${var} ${var_internal} PARENT_SCOPE)
3838
endif()
39+
message(STATUS "Checking DARWIN_${sdk_name}_SYSROOT - '${var_internal}'")
3940
set(DARWIN_${sdk_name}_CACHED_SYSROOT ${var_internal} CACHE STRING "Darwin SDK path for SDK ${sdk_name}." FORCE)
4041
endfunction()
4142

compiler-rt/cmake/config-ix.cmake

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

285285
if(NOT DARWIN_osx_SYSROOT)
286+
message(WARNING "Could not determine OS X sysroot, trying /usr/include")
286287
if(EXISTS /usr/include)
287288
set(DARWIN_osx_SYSROOT /)
288289
else()

0 commit comments

Comments
 (0)