adnan kamili
adnan kamili

Reputation: 9445

Compiling for macOS arm64 arch

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.

Upvotes: 3

Views: 3772

Answers (2)

mstorsjo
mstorsjo

Reputation: 13317

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).

Upvotes: 4

zhiou
zhiou

Reputation: 1

It works fine when I removed the 'EXCLUDED_ARCHS' part.

Upvotes: -3

Related Questions