简体   繁体   中英

Building project for M1 Mac fails because of architectures it believes are missing

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.

在此处输入图像描述

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.

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM