Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28116] Xcode 12: Cannot build modules anymore

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2020-09-10T16:00:21.000+0000
Affected Version/sRelease 9.2.0
Fix Version/sRelease 9.2.0
ComponentsiOS
Labelsn/a
ReporterHans Knöchel
AssigneeChristopher Williams
Created2020-09-09T11:00:35.000+0000
Updated2020-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

Comments

  1. Christopher Williams 2020-09-09

    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.
  2. Christopher Williams 2020-09-09

    https://github.com/appcelerator/titanium_mobile/pull/12026
  3. Hans Knöchel 2020-09-10

    Thanks Chris! The PR can btw be tested with https://github.com/hansemannn/titanium-widget-kit which is also affected by this change.
  4. Christopher Williams 2020-09-10

    [~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-ab2479047e1642c6a102069cd6069bb2R24
  5. Hans Knöchel 2020-09-11

    Good 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):
       [TRACE] [xcode-macos] #import <TitaniumKit/TiBase.h>
       [TRACE] [xcode-macos]         ^
       [TRACE] [xcode-macos] /Users/hans/Documents/dev/titanium/titanium-widget-kit/ios/Classes/TiWidgetkitModule.swift:11:8: error: could not build Objective-C module 'TitaniumKit'
       [TRACE] [xcode-macos] import TitaniumKit
       [TRACE] [xcode-macos]        ^
       [ERROR] [xcode-macos] ** ARCHIVE FAILED **
       [ERROR] [xcode-macos] The following build commands failed:
       [ERROR] [xcode-macos] 	CompileSwift normal arm64 /Users/hans/Documents/dev/titanium/titanium-widget-kit/ios/Classes/TiWidgetkitModule.swift
       [ERROR] [xcode-macos] 	CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
       [ERROR] [xcode-macos] 	CompileSwift normal x86_64 /Users/hans/Documents/dev/titanium/titanium-widget-kit/ios/Classes/TiWidgetkitModule.swift
       [ERROR] [xcode-macos] 	CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
       [ERROR] [xcode-macos] (4 failures)
       
    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.

JSON Source