8

We have a project that uses many AWS libraries. On first attempting to build it, using carthage, it downloaded binaries and it did not build at all. So we ran carthage --no-use-binaries and it built the libs.

Then this error occurs:

LoginService.swift:9:8: Module 'AWSMobileClient' was created for incompatible target arm64-apple-ios9.0: ..Carthage/Build/iOS/AWSMobileClient.framework/Modules/AWSMobileClient.swiftmodule/arm64.swiftmodule

Based on this stack overflow thread, we add arm64 to excluded architectures for the simulator.

enter image description here

Which makes all the aws code compile (yay) but then, this error occurs trying to use a framework that is coming in via the Swift Package Manager:

[].swift:10:8: Could not find module 'Parma' for target 'x86_64-apple-ios-simulator'; found: arm64, arm64-apple-ios-simulator

So it wants the x86 version of this lib, and cannot find it.

The app does run on the phone now. But not the simulator of course. Not sure if there is a way to figure out which architectures are built by SPM? or control it. I did reset the SPM cache after excluding the arm64 arch.

Rob
  • 11,446
  • 7
  • 39
  • 57

2 Answers2

4

Hey I've come across the issue. Just open your old project by Rosetta and build it. Then uncheck open by Rosetta and build it. It helped me to open old project on m1

  • Yeah that didn't work. On going back to Rosetta, I get build failures. Will update. – Rob Jan 14 '21 at 22:46
4

I think the best solution for getting this working on M1 is to use XC-Frameworks.

carthage update --use-xcframeworks

This will only build the valid archs you need. If you have any dependencies that don't support XCFrameworks yet you'll have to run lipo to remove x86 simulator targets in your build phase.

Retebitall
  • 475
  • 5
  • 8
  • Yeah I should have come back and updated this. This was indeed the solution. – Rob Apr 19 '21 at 19:03
  • I think I have another question about the fact that Swift Packages do NOT build to XCFrameworks so you can still run into this if the dependency came from SPM, which sucks... but yeah, --use-xcframeworks has solved all my complaints with Carthage on M1. – Rob Apr 19 '21 at 19:03
  • 1
    where and how to run the code carthage update --use-xcframeworks ? – user1090751 Jul 22 '21 at 17:03