I want to port my MacApp to a universal build including binaries for the new Apple Silicon Arm64 chips.
Besides being on Xcode 12.1, using the Standard Architectures build setting, what else do I need to do? My scheme only shows Any Mac (Intel)
I want to port my MacApp to a universal build including binaries for the new Apple Silicon Arm64 chips.
Besides being on Xcode 12.1, using the Standard Architectures build setting, what else do I need to do? My scheme only shows Any Mac (Intel)
2
Answers
You should definitely read Apple’s official guide on this topic: https://developer.apple.com/documentation/xcode/building_a_universal_macos_binary
The process is very well covered there.
Also, Apple has one more guide for Apple Silicon: https://developer.apple.com/documentation/xcode/porting_your_macos_apps_to_apple_silicon
It’s also a must-read.
So the first step is obviously to update the architectures list.
Current MacMini/Macbooks have
x86_64
, Apple Silicon hasarm64
and so on.The you should compile, and remove all compile errors one by one.
When building my app for Apple Silicon, I’ve faced such issues:
Wrap platform-specific code (this headline copied from Apple tutorial 🙂 )
e.g.
Build fat libraries (this is a custom explanation 🙂 )
You app may use any C/C++ static/dynamic libs, such as
Curl
,OpenSSL
etc.In order to make an app universal, you should make sure that all these libs contain the code for all platforms.
lipo
will be you friend here (this is also covered in a guide).An example of building a static lib for Apple Silicon: https://cutecoder.org/programming/compile-open-ssl-apple-silicon/
I’m not sure I’ve fully covered your question, so please ask more details and I’ll clarify.
Xcode 12.1 does not have the macOS 11 SDK, which you need to compile for Apple Silicon. Until macOS 11 ships, you will have to download a beta version of Xcode 12 that includes the macOS 11 SDK, such as the Xcode 12.2 beta.