couchbase/couchbase-lite-ios

Module compiled with Swift 5.3.2 cannot be imported by the Swift 5.5 compiler

Maor-Mac opened this issue · 6 comments

Describe the bug
When compiling the project with xcode 12.5 I'm getting this error:

unable to load standard library for target 'arm64-apple-ios9.0'
Module compiled with Swift 5.3.2 cannot be imported by the Swift 5.5 compiler

To Reproduce
Share a unit test or sample project or steps to reproduce the behavior

  1. Compile CouchbaseLite-Swift-Enterprise 2.8.4 using xcode 12.5

Expected behavior
Compile fine

Platform (please complete the following information):

  • Device: iPhone 11
  • OS: iOS 14
  • Couchbase Version CouchbaseLiteSwift 2.8.4

I assume, you have tried the .framework. Could you please try using XCFramework from the Downloads.

Please feel free to reopen the issue, in case you are still facing the issue

We encountered the same problem after switching to Xcode 13.2.1
We were trying to build a Flutter plugin using the CouhbaseLiteSwift 2.8.4 pod.

There seems to be something to do with the BUILD_LIBRARY_FOR_DISTRIBUTION flag in Xcode.
See this link in Stack Overflow for more details

@matsunanaro Could you please elaborate on the issue you faced. Incompatible module will be shown as error for many reasons, like when arm64-simulator arch is missing, or backward incompatibility etc...

  • Are you using cocoapod/carthage/downloads page?

    • Cocoapod/Carthage = is a FAT binary without the Apple M1(arm64-simulator) architecture supported.
    • Downloads page = there is .xcframework and .framework, similar to cocoapod/carthage .framework is not including the arm64 arch. But if you use .xcframework, it should work for Apple M1 machine(we already had tests to validate this).
  • From what I understand from this current issue, they are using .framework on Apple M1. Could you please open a new issue, if your issue is different from this one? Also make sure to include all the error you are seeing,(OR a working sample project with error, OR steps to reproduce the same issue).

  • About the BUILD_LIBRARY_FOR_DISTRIBUTION, we are already setting this

@matsunanaro Could you please elaborate on the issue you faced. Incompatible module will be shown as error for many reasons, like when arm64-simulator arch is missing, or backward incompatibility etc...

  • Are you using cocoapod/carthage/downloads page?

I'm using cocaopod and building on an Intel based MacBook Pro 2019 with Xcode 13..2.1 on Monterey MacOS

  • About the BUILD_LIBRARY_FOR_DISTRIBUTION, we are already setting this

The flag seems to be still missing in the Debug configuration

Yes, you're right. The BUILD_LIBRARY_FOR_DISTRIBUTION flag was a red herring. The building failure was due to the missing arm64-simulator binary and the fact that Xcode 13.2.1 would always try to load all supported architectures of the simulator. The issue was resolved by excluding arm64 for simulator. For more details, see this closed issue