Xcode: Setting ARCHS to NATIVE_ARCH_ACTUAL doesn't behave well on Apple Silicon
Using cmake 3.18.2 and Xcode 12 beta 6. Default cmake projects will not run through Xcode.
This is because cmake now sets ARCHS to NATIVE_ARCH_ACTUAL.
NATIVE_ARCH_ACTUAL is set to arm64e
, which is an instruction set which can only be used in kernel space currently. arm64
is the correct space. This was introduced to fix this issue #20893 (closed).
I sent a feedback to Apple about this and I copy their reply.
First, do not set ARCHS to NATIVE_ARCH_ACTUAL. You should leave ARCHS at the default, which is ARCHS_STANDARD.
Secondly, NATIVE_ARCH_ACTUAL is arm64 when using the new build system. The legacy build system has different values for this build setting. Please stop using the legacy build system, and switch to the new build system.
This seems like it is a few different cmake things coming together to cause this.
- New build system support would make this go away #18088 (closed)
- Using ARCHS_STANDARD would make it go away, but probably causes issues in other parts of cmake (e.g.
try_compile
)