[TIMOB-28138] iOS/macOS Catalyst: Cannot build iOS-only modules
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-09-22T15:49:57.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 9.2.0 |
Components | iOS, Mac |
Labels | n/a |
Reporter | Hans Knöchel |
Assignee | Vijay Singh |
Created | 2020-09-15T21:00:11.000+0000 |
Updated | 2020-09-23T18:08:00.000+0000 |
Description
When trying to build an iOS only module, it fails with multiple errors. The error can be reproduced in this module: https://github.com/hansemannn/titanium-widget-kit
The reason may be that the module contains the iOS-only framework "WidgetKit". I unselected macOS support in the Xcode project, but the CLI still tries to build for Catalyst as well.
[~hknoechel] you beat us to filing the ticket! :) Chris and I had been discussing this on a back channel. Our current thinking is I think one of the following: * Make the target support (iOS, macOS) declarable by a developer via the manifest or timodule. Marking it as not supporting a target will cause it to not build for that target * Allow the mac build to fail, just warning if it does Either would be combined with changes in the app build to detect whether a module supports the target specified by an app developer, erroring if not. As a power-user of module development which sounds more sensible to you? cc [~cwilliams]
[~eharris] See https://github.com/appcelerator-modules/ti.facebook/pull/128#issuecomment-693011941 1. For above issue I think we can allow mac build fail with warning. 2. Another issue in which third party frameworks do not have simulator 'arm64' architecture, we can check "platform" folder of module and if there is any file having '.framework' extension, exclude simulator 'arm64' architecture.
@Ewan: I think it should use the setting in Xcode (the platform checkbox), which is saved in the pbxproj. I can do the "dirty work" to extract it if it helps. Is there a workaround to skip macOS compilation for now? Ti.WidgetKit is required to refresh widgets, so it's kind of a thing for us :-)
https://github.com/appcelerator/titanium_mobile/pull/12093
@Vijay: Unfortunately your PR does not work so far (see logs below). Also, I would really attempt to not cause the build to ignore a build failure and instead only build what's supposed to be build. Once the check from the pbxproj is present, that should be able to guard similar to what you did now. Here is my attempt to check if macOS is enabled or not (working): https://github.com/appcelerator/titanium_mobile/compare/master...hansemannn:TIMOB-28138 I probably missed another step /
next()
call because it fails at the end with not finding some archs, but maybe it helps!https://github.com/appcelerator/titanium_mobile/pull/12093
[~hknoechel] 1. The modules which are not generating frameworks (Objc based modules), do not have option to out out from mac-target build in Xcode project. This option is available for frameworks only. I think your PR will not work for all modules. 2. In my PR, the module build is failing because the architectures mentioned in manifest file is not same as in created XCFramework. Reason is, in _buildModule.js we are using hardcoded way to read architecture. [~jvennemann] is working on parsing of Info.plist available inside .xcframework as part of PR https://github.com/appcelerator/titanium_mobile/pull/12092 . After that we can update it to use architectures from there.
It seems like *NO* modules that contain native frameworks (.framework extension) can be compiled right now. The error is:
And since the module is a swift module, it cannot be compiled with Xcode 11, because it requires the ABI stability of Swift 5. Therefore all Swift based modules are blocked right now. I hope one of the pending PR's helps. If you need more concrete modules for testing, let me know and I can send it over.
[~hknoechel] It should be fixed in this PR. Can you try and let me know if you still have issue? Thanks!
The module build works, the app build as well, but once the module (here: Ti.WidgetKit) is require()'d, it fails to find it for the architecture (tested both iOS Simulator and iOS device)
FR Passed. Closing.
One last question from my end: We get the following warning / note during the build for an iPhone XS:
Is that fine? Should there be an improvement ticket to properly link armv7 directly?
[~hknoechel] I think this should be fine. iPhone 5s and later supports arm64. iOS 14 is supported from iPhone SE. As WidgetKit framework is only supported for iOS 14+, I think Apple has dropped armv7 support from WidgetKit framework. So it is generating arm64 only for devices. We are not excluding "armv7" from binary while building module.