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

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 4 08:04:59 PDT 2022


delcypher requested changes to this revision.
delcypher added a comment.
This revision now requires changes to proceed.

I don't think this is the right fix. Having a broken SDK setup is a real problem that should not be hidden by changing this to a warning.

As the original issue notes <https://github.com/llvm/llvm-project/issues/57037> you can configure with `-DCOMPILER_RT_ENABLE_IOS=OFF` to explicitly not build compiler-rt for iOS.

If you wanted this to be more automatic then the right fix would be to compute the default for `COMPILER_RT_ENABLE_IOS` to be ON if the iOS SDK is present and OFF if it is not. So roughly something like

  find_darwin_sdk_dir(has_ios_sdk ios)
  if ("${has_ios_sdk}" STREQUAL "")
    set(COMPILER_RT_ENABLE_IOS_DEFAULT OFF)
  else()
    set(COMPILER_RT_ENABLE_IOS_DEFAULT ON)
  endif()
  
  option(COMPILER_RT_ENABLE_IOS "Enable building for iOS" "${COMPILER_RT_ENABLE_IOS_DEFAULT}")

Doing it this way means that

- by default if there's no iOS SDK then the iOS compiler-rt build will be disabled
- if `COMPILER_RT_ENABLE_IOS=ON` is explicitly provided and there's no iOS SDK when we will still fail the build which is desirable.
- if `COMPILER_RT_ENABLE_IOS=OFF` is explicitly provided and there's an iOS SDK available then we will respect the explicit request to **not** build compiler-rt for iOS


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133273/new/

https://reviews.llvm.org/D133273



More information about the llvm-commits mailing list