phrase / ios-sdk

Phrase Over the Air iOS SDK
https://phrase.com
Other
14 stars 3 forks source link

Error building with PhraseSDK for the iOS simulator on an M1 Mac #26

Closed cabeca closed 3 years ago

cabeca commented 3 years ago

Hello,

I'm trying to build our project on a brand new M1 MacBook Pro, but I get this error:

Failed to build module 'PhraseSDK' from its module interface; the compiler that produced it, 'Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)', 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)'

I'm using Xcode Version 12.2 (12B45b) on macOS BigSur 11.1

This is a major blocker for us. Do you have any workarounds for this? Any updates on distributing PhraseSDK as a XCFramework?

Miguel Cabeça

winkelsdorf commented 3 years ago

Hello @cabeca,

thanks for your report! How are you integrating the SDK? Carthage, CocoaPods or manually? The error you provide points to an issue with Module Stability, which is enabled.

But for M1 arm64 you will likely need a new build if you are targeting the arm64 Simulator. We are planning to release an Universal xcframework Version within the next 2-3 weeks.

cabeca commented 3 years ago

Sorry for the lack of information.

thanks for your report! How are you integrating the SDK? Carthage, CocoaPods or manually? The error you provide points to an issue with Module Stability, which is enabled.

We are integrating the PhraseSDK manually.

But for M1 arm64 you will likely need a new build if you are targeting the arm64 Simulator. We are planning to release an Universal xcframework Version within the next 2-3 weeks.

Yes. I forgot to mention that I was building for the iOS simulator on the M1 Mac.

Looking forward for the new XCFramework release!

winkelsdorf commented 3 years ago

@cabeca No problem. If you are integrating manually an xcframework would be really easier for you, sorry for the inconvenience caused by the delay. Sure, I'll keep you updated.

gutaker commented 3 years ago

Hi guys! Do you have any ETA on this issue? My new project heavily relies on your solution.

winkelsdorf commented 3 years ago

@gutaker Unfortunately not officially as there are still several issues with the different Package Managers. We need to investigate all possible Build and Package Manager variants. As of today, Carthage does not support xcframeworks (https://github.com/Carthage/Carthage/issues/2799) and CocoaPods has issues with current v1.10.0 on M1 (fixed for 1.10.1 https://github.com/CocoaPods/CocoaPods/pull/10234).

Beside this many tools around the build chain currently are unstable on M1 arm64 Architecture, see e.g. https://github.com/CocoaPods/CocoaPods/issues/9907.

But the Framework as it is supports A) Module Stability and B) is able to run on Device (arm64) and x86_64 Simulators.

Have you tried setting Any iOS Simulator SDK to arm64 for Excluded Architectures in the Build Settings of the Target? I am able to compile and run the current SDK on Device without issues doing that. Sadly, if your main development machine is already a M1, you cannot use the arm64 Simulator this way. Another possible intermediate solution is to run Xcode and/or iOS Simulator using Rosetta (which works as it is a Universal Binary).

Furthermore, if you add the framework manually please remember to still slice it accordingly, as it is a fat binary.

Sorry again for the inconvenience, we're working hard to provide a solution as soon as possible.

gutaker commented 3 years ago

Thanks! Rosetta trick for Xcode did the job!

winkelsdorf commented 3 years ago

@gutaker Glad to hear that, happy to help! Happy Holidays!

angelolloqui commented 3 years ago

I am having the same issue. Is there any expected release time? how did you manage to work around it?

I am using Cocoapods for dependency management on an M1

winkelsdorf commented 3 years ago

@angelolloqui Release is expected within the next 24-48 hrs. We are now defaulting to xcframeworks, where Xcode automatically handles the different Platforms. It will also include arm64 architecture where needed.

In the meantime you could always set arm64 to the excluded Simulator architectures within your Project's Build Configuration.

winkelsdorf commented 3 years ago

@all New version is live. Looking forward to your feedback.