I am using macOS 10.15.7 to build a simple hello world C++ program for macOS arm64 architecture (not iOS). I have Xcode 12 installed. I tried the following:
xcodebuild -project TestApp.xcodeproj clean build ARCHS=arm64 EXCLUDED_ARCHS=""
But received the following error:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/sys/cdefs.h:807:2: error: Unsupported architecture
#error Unsupported architecture
and similar other errors.
I supposed I can cross-build for upcoming ARM-based macs from my x86_64 mac, but it doesn’t seem to work.
2
Answers
It works fine when I removed the ‘EXCLUDED_ARCHS’ part.
The SDK for macOS Big Sur wasn’t released as part of the public Xcode 12.0 release, it only contains the SDK for Catalina (macOS 10.15).
To target macOS Big Sur (and macOS on Apple Silicon), you need the beta SDK (Xcode 12.2 beta).