[TIMOB-28116] Xcode 12: Cannot build modules anymore
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-09-10T16:00:21.000+0000 |
Affected Version/s | Release 9.2.0 |
Fix Version/s | Release 9.2.0 |
Components | iOS |
Labels | n/a |
Reporter | Hans Knöchel |
Assignee | Christopher Williams |
Created | 2020-09-09T11:00:35.000+0000 |
Updated | 2020-09-22T23:07:43.000+0000 |
Description
Since a few beta versions, it's not possible to build modules (like Ti.Facebook) with Xcode 12 anymore. Make sure Xcode 12 is selected (
sudo xcode-select -s /Applications/Xcode-beta.app
) and build the module with ti build -p ios --build-only
.
The error is:
[ERROR] Failed to generate universal binary (code 1):
[ERROR] fatal error: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: ti.facebook/ios/build/Release-iphoneos/libfacebook.a and ti.facebook/ios/build/Release-iphonesimulator/libfacebook.a have the same architectures (arm64) and can't be in the same fat output file
Hey [~hknoechel] - the long story short is that with Xcode 12, Apple is adding arm64 simulator as a target/arch combo. That "clashes" with arm64 device. So trying to create a "fat universal binary" doesn't work. We have to move over to xcframeworks (or explicitly exclude arm64 sim). The work is already done in the macOS support PR (since that already requires move to xcframeworks). You can try to build with that PR, our wait until we land that PR (or the xcframeworks support separately). Or you can do what the linked tickets did and hack a short-term fix of just excluding arm64 sim.
https://github.com/appcelerator/titanium_mobile/pull/12026
Thanks Chris! The PR can btw be tested with https://github.com/hansemannn/titanium-widget-kit which is also affected by this change.
[~hknoechel] A quick note if you didn't create the module from the template in one of the xcframework PRs - I had to hack in a reference to TitaniumKit.xcframework for a swift based module. The module template sticks in an absolute path pointing to the version of the xcframework from the SDK used to create the module. In apple-sign-in, I use
$TITANIUM_SDK
to build the path which works when building from CLI, but not in the Xcode project: https://github.com/appcelerator-modules/titanium-apple-sign-in/pull/16/files#diff-ab2479047e1642c6a102069cd6069bb2R24Good to know! I just pulled latest master and tried migrating the module in [this commit](https://github.com/hansemannn/titanium-widget-kit/commit/0cde540c4bbe169e3ce6f3ad248cee8bb3894c8b), but it still fails (with a different error now):
It works when building in Xcode (CMD+B), but the CLI is required to package it. Same happens btw when creating a new Swift module from the scratch.