[PATCH] D69610: Fix compiler-rt build on macOS without XCode

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 30 02:03:25 PDT 2019


arichardson created this revision.
arichardson added reviewers: delcypher, yln.
Herald added subscribers: llvm-commits, Sanitizers, mgorny, dberris.
Herald added projects: Sanitizers, LLVM.

Starting with 8a5bfbe6db2824642bf9a1d27a24c5b6132b244f (D68292 <https://reviews.llvm.org/D68292>) this file
unconditionally uses xcodebuild to get the SDK version. On my system this
always fails with
`xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance`


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69610

Files:
  compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake


Index: compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
===================================================================
--- compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
+++ compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
@@ -65,6 +65,16 @@
       ERROR_FILE /dev/null
     )
   endif()
+  # Finally, use xcrun in case XCode is not installed.
+  if((NOT ${result_process} EQUAL 0) OR "" STREQUAL "${var_internal}")
+    execute_process(
+            COMMAND  xcrun --sdk ${sdk_name} --show-sdk-version
+            RESULT_VARIABLE result_process
+            OUTPUT_VARIABLE var_internal
+            OUTPUT_STRIP_TRAILING_WHITESPACE
+            ERROR_FILE /dev/null
+    )
+  endif()
   if(NOT result_process EQUAL 0)
     message(FATAL_ERROR
       "Failed to determine SDK version for \"${sdk_name}\" SDK")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69610.227049.patch
Type: text/x-patch
Size: 834 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191030/f59a3bf0/attachment.bin>


More information about the llvm-commits mailing list