Skip to content

Regression: iOS multi-arch build doesn't work unless CMAKE_APPLE_ARCH_SYSROOTS is set

It looks like the fix made by @brad.king in !4583 (merged) didn't fully fix the issue.

The following iOS project worked fine in CMake 3.16:

CMakeLists.txt:

project (ios-sample C)

set(SOURCES
  helloworld.c
)

add_library (ios-sample SHARED ${SOURCES} ${HEADERS})

helloworld.c:

#include <stdio.h>

int32_t HelloWorld()
{
    return 0;
}

Configuring the build with the following CMake command still results in the "No SDK found for architecture" messages mentioned in #20534 (closed) (interestingly the configure step returns exit code 0, this sounds like another issue):

$ cmake <source dir> -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="armv7;armv7s" -DCMAKE_OSX_DEPLOYMENT_TARGET=8.0
CMake Warning at /Volumes/cmake-3.17.20200414-ge565489-Darwin-x86_64/CMake.app/Contents/share/cmake-3.17/Modules/Platform/Darwin-Initialize.cmake:204 (message):
  No SDK found for architecture 'armv7'
Call Stack (most recent call first):
  /Volumes/cmake-3.17.20200414-ge565489-Darwin-x86_64/CMake.app/Contents/share/cmake-3.17/Modules/Platform/Darwin-Initialize.cmake:213 (_apple_resolve_multi_arch_sysroots)
  /Volumes/cmake-3.17.20200414-ge565489-Darwin-x86_64/CMake.app/Contents/share/cmake-3.17/Modules/Platform/iOS-Initialize.cmake:1 (include)
  /Volumes/cmake-3.17.20200414-ge565489-Darwin-x86_64/CMake.app/Contents/share/cmake-3.17/Modules/CMakeSystemSpecificInitialize.cmake:21 (include)
  CMakeLists.txt:2 (project)


CMake Warning at /Volumes/cmake-3.17.20200414-ge565489-Darwin-x86_64/CMake.app/Contents/share/cmake-3.17/Modules/Platform/Darwin-Initialize.cmake:204 (message):
  No SDK found for architecture 'armv7s'
Call Stack (most recent call first):
  /Volumes/cmake-3.17.20200414-ge565489-Darwin-x86_64/CMake.app/Contents/share/cmake-3.17/Modules/Platform/Darwin-Initialize.cmake:213 (_apple_resolve_multi_arch_sysroots)
  /Volumes/cmake-3.17.20200414-ge565489-Darwin-x86_64/CMake.app/Contents/share/cmake-3.17/Modules/Platform/iOS-Initialize.cmake:1 (include)
  /Volumes/cmake-3.17.20200414-ge565489-Darwin-x86_64/CMake.app/Contents/share/cmake-3.17/Modules/CMakeSystemSpecificInitialize.cmake:21 (include)
  CMakeLists.txt:2 (project)


-- The C compiler identification is AppleClang 11.0.0.11000033
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/alexander/dev/test/ios_arm_repro/build

If I pass -DCMAKE_APPLE_ARCH_SYSROOTS="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/;/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/" I can workaround the issue but this shouldn't be necessary.

Edited by Alexander Köplinger
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information