Home:ALL Converter>Building ionic cordova app for iOS on M1 Mac

Building ionic cordova app for iOS on M1 Mac

Ask Time:2022-01-20T23:52:14         Author:DanielRead

Json Formatter

@ionic/angular: 6.0.1 & cordova-ios: 6.2.0

Hey there,

I just got my new M1 Macbook Pro setup and I'm trying to run the command

ionic cordova build ios

It's failing with

building for iOS Simulator, but linking in object file built for iOS, file 'FILE_PATH' for architecture arm64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

...

** BUILD FAILED **

I googled this and everything I'm finding online says

Basically you have to exclude arm64 for simulator architecture both from your project and the Pod project,

and provide tutorials on how to do this via XCode example

https://stackguides.com/questions/63607158/xcode-12-building-for-ios-simulator-but-linking-in-object-file-built-for-ios.

When I look in XCode, I don't see a section for "Excluded Architectures". Even if I did see this, my build flow removes & adds back the ios platform so I would have to do this every time...

Then I see people are saying add a post_install script to PodFiles. When using Cordova/Ionic how would I add a post_install script for the PodFile?

If I plug my phone into the computer during the build, it works but this is not an ideal solution as I want it to be able to build a bunch of white-labeled apps without having my phone required to be plugged into my computer during this process.

Anybody have any solutions for this / information?

Update: I got the builds to complete successfully using a terminal opening with Rosetta. Steps to reproduce:

  1. Got to Applications->Utilities
  2. Duplicate Terminal
  3. Rename 2nd terminal to Rosetta-Terminal
  4. right click rosetta-terminal & click Get Info
  5. Check "Open using Rosetta"
  6. Do my builds via Rosetta-Terminal

Everything seems to be working now... I'm sure this isn't the "ideal" solution, but it works for now

Duplicate terminal

Author:DanielRead,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/70789326/building-ionic-cordova-app-for-ios-on-m1-mac
yy