orchetect/MIDIKit

CI: Build Universal Binary 2 (x86_64, arm64)

orchetect opened this issue · 2 comments

Trying to get GitHub Actions CI which runs on Intel hardware to build a Universal Binary 2 (x86_64, arm64) but running into an issue with xcodebuild not liking it.

Build succeeds if ONLY_ACTIVE_ARCH = YES but only builds x86_64.

Setting ONLY_ACTIVE_ARCH = NO causes both architectures to build.

Locally, on an M1 Max machine of mine it works fine and compiles both. But it errors out on an Intel machine.

Some hints:

Not the same issue, but related: Mac Catalyst throws a similar error related to architectures.

Feedback from @PeterWier:

I have tried every workaround found on StackOverflow. Using VALID_ARCHS is strongly discouraged by Apple (VALID_ARCHS has actually has been removed from Xcode since the introduction of Xcframeworks). Using an Xcframework is probably the only solution. My workaround is to add MIDKit via drag and drop instead of the package.

OpenSSL-Universal is the most widely used Xcframework that works on all platforms including Catalyst and could be a good example: https://github.com/krzyzanowskim/OpenSSL

This works as a solution for CI:

xcodebuild build ... -destination "generic/platform=macOS,name=Any Mac"

xcodebuild test ... -destination "platform=macOS"