couchbase/couchbase-lite-ios

failed to build module 'CouchbaseLiteSwift' from its module interface

lacklock opened this issue · 15 comments

Describe the bug
On Xcode 12.2,using cocoapods push to trunk, validating can't pass.

Error message:

    - ERROR | [iOS] xcodebuild:  XX/Couchbase/CBDatabase.swift:10:8: 
error: failed to build module 'CouchbaseLiteSwift' from its module interface; 
the compiler that produced it, 'Apple Swift version 5.3 (swiftlang-1200.0.29.2 clang-1200.0.30.1)', 
may have used features that aren't supported by this compiler, 'Apple Swift version 5.3.1 (swiftlang-1200.0.41 clang-1200.0.32.8)'

Platform (please complete the following information):

  • OS: [macOS 11.0.1]
  • Couchbase Version [2.8.1]

Could you please share the Podfile as well as the commands used?

  s.name         = "KWFoundationToolBox"
  s.version      = "2.0.0-beta.2"
  s.summary      = "app通用代码库"
  s.homepage     = "http://dev.meshkit.cn/kiwi-team/iOSFoundationToolBox"
  s.license      = { :type => 'MIT', :file => 'LICENSE' }
  s.author       = {"Zhuo" => "lacklock@icloud.com"}
  s.source_files = 'KWFoundationToolBox/*.swift','KWFoundationToolBox/**/*.swift','KWFoundationToolBox/**/**/*.swift'
  s.source       = {:git => 'git@dev.meshkit.cn:kiwi-team/iOSFoundationToolBox.git', :tag => s.version.to_s}
  s.resource_bundles = { 'KWFoundationToolBox' => ['KWFoundationToolBox/Resources/*','KWFoundationToolBox/Resources/**/*'] }
  s.requires_arc = true

  s.frameworks   = 'UIKit'
  s.ios.deployment_target = '13.0'
  s.swift_version = '5.0'

  s.dependency 'RealmSwift', '~> 10.0'
  s.dependency 'SnapKit'
  s.dependency 'CouchbaseLite-Swift'
  s.dependency 'EasyAnimation', '~> 2.2'
  s.dependency 'RxSwift', '~> 5.0'
  s.dependency 'RxCocoa', '~> 5.0'
  s.dependency 'PromiseKit'
  s.dependency 'SuperCodable'
  s.dependency 'Amplitude'
end

Will validate the issue first: https://issues.couchbase.com/browse/CBL-1473, after that will continue from there.

c4w7 commented

We are also experiencing this bug when trying to build for profiling in Xcode, so we cannot initiate profiling our app in Instruments, because the framework it is in stops the build process.

did you tried skipping the arm64 for the simulator iOS SDK, from the host app?

Excluded Architectures
 Debug -> Any iOS Simulator SDK: arm64
 Release -> Any iOS Simulator SDK: arm64

https://developer.apple.com/forums/thread/655121

c4w7 commented

It looks like if I add arm64 to the excluded architectures list on the host app, as well as the framework that links against Couchbase then I'm able to build for profiling. It looks like when I profile in Instruments that its not symbolicating everything though. This is decent workaround for the moment, but this issue really needs to be resolved so we can profile without changing project architecture settings.

We have already plans to share XCFramework through Cocoapod, which should ideally resolve the issue. Is it possible to try out CouchbaseLiteSwift.xcframework directly instead of adding as dependency? You can download xcframework from downloads page and please let us know the results.

Closing this, when we distribute the XCFramework via Cocoapod should resolve the issue, which is already on our radar.

Also, if you are an enterprise customer, please do open a support ticket, which can increase the priority of the task.

c4w7 commented

@jayahariv I realize that this issue was originally opened against Cocoapods, but I hope that won't be the only means for this fix. We are actually pulling down couchbase through Swift Package Manager and need the fix through there as well. Thank you for your help.

@c4w7 Swift Package Manager is sharing XCFramework, it should work without excluding the architecture. Have you tried and then failed?

c4w7 commented

@jayahariv I'm not sure what you mean. Without excluding the architecture on our application frameworks we got an error building for profiling due to the issue in this bug. When I excluded the architecture I was able to build for profiling, but got all sorts of weirdness with unsymbolicated symbols in Instruments.

Are you using Cocoapods or Swift Package Manager to include CouchbaseLiteSwift?

If you are using Swift Package Manager, I assume we don't need to add the hack by excluding the arm64. Is that correct or you already using SPM and still have to exclude arm64?

To clarify things, are you getting the error, unable to load standard library for target 'arm64-apple-ios14.0-simulator' when include via Swift Package Manager(SPM)?

c4w7 commented

To clarify things, are you getting the error, unable to load standard library for target 'arm64-apple-ios14.0-simulator' when include via Swift Package Manager(SPM)?

Yes that is the error we get when trying to build for profiling.

thanks @c4w7