[PATCH] D133273: [compiler-rt][macOS]: Fix building compiler-rt without iOS related SDKs

Tobias Hieta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 4 07:31:34 PDT 2022


thieta created this revision.
thieta added reviewers: bc-lee, delcypher, thakis, carlocab.
Herald added subscribers: Enna1, mgorny, dberris.
Herald added a project: All.
thieta requested review of this revision.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.

In issue #57037 it was reported that if you try to build compiler-rt
with just xcode command line tools (without the iOS related SDKs)
CMake would abort with a fatal error.

This makes the fatal error a warning instead.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133273

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
@@ -70,8 +70,10 @@
     )
   endif()
   if(NOT result_process EQUAL 0)
-    message(FATAL_ERROR
+    message(WARNING
       "Failed to determine SDK version for \"${sdk_name}\" SDK")
+    set(${var} "0" PARENT_SCOPE)
+    return()
   endif()
   # Check reported version looks sane.
   if (NOT "${var_internal}" MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+)?$")
@@ -100,7 +102,7 @@
     message(WARNING "Detecting supported architectures from 'ld -v' failed. Returning default set.")
     set(ARCHES "i386;x86_64;armv7;armv7s;arm64")
   endif()
-  
+
   set(${output_var} ${ARCHES} PARENT_SCOPE)
 endfunction()
 
@@ -135,7 +137,7 @@
     endif()
   endif()
 
-  # The simple program will build for x86_64h on the simulator because it is 
+  # The simple program will build for x86_64h on the simulator because it is
   # compatible with x86_64 libraries (mostly), but since x86_64h isn't actually
   # a valid or useful architecture for the iOS simulator we should drop it.
   if(${os} MATCHES "^(iossim|tvossim|watchossim)$")
@@ -144,7 +146,7 @@
 
   set(working_archs)
   foreach(arch ${archs})
-   
+
     set(arch_linker_flags "-arch ${arch} ${os_linker_flags}")
     if(TEST_COMPILE_ONLY)
       # `-w` is used to surpress compiler warnings which `try_compile_only()` treats as an error.
@@ -259,7 +261,7 @@
         ${DARWIN_EXCLUDE_DIR}/${LIB_OS}${smallest_version}-${LIB_ARCH}.txt)
     endif()
   endif()
-  
+
   set(${output_var}
       ${${LIB_ARCH}_${LIB_OS}_BUILTINS}
       ${${LIB_OS}_${LIB_ARCH}_BASE_BUILTINS}
@@ -538,7 +540,7 @@
       ${COMPILER_RT_OUTPUT_LIBRARY_DIR}/macho_embedded)
     set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR
       ${COMPILER_RT_INSTALL_LIBRARY_DIR}/macho_embedded)
-      
+
     set(CFLAGS_armv7 -target thumbv7-apple-darwin-eabi)
     set(CFLAGS_i386 -march=pentium)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133273.457857.patch
Type: text/x-patch
Size: 2055 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220904/30f17963/attachment.bin>


More information about the llvm-commits mailing list