ionic-team / capacitor

Build cross-platform Native Progressive Web Apps for iOS, Android, and the Web ⚡️
https://capacitorjs.com
MIT License
12.31k stars 1.01k forks source link

[Feature]: Add a flag for `ios run` to allow for building with Rosetta enabled #7425

Open JaapWeijland opened 7 months ago

JaapWeijland commented 7 months ago

Description

Because some plugins can't be build for simulators using arm64 arch, it would be nice to allow for building for simulators using Rosetta using the cli.

Platforms

Request or proposed solution

Add a flag like --arch_x86_64 or --with-rosetta or similar to allow for building for simulators using the x86_64 arch. Currently all simulators listed when using ios run with Xcode 15.3 are arm64 targets and some plugins don't support arm64, like the capacitor-mlkit/barcode-scanning plugin.

I verified that the core of this problem is solved by adding ,arch=x86_64 to this line: https://github.com/ionic-team/capacitor/blob/5b2ab7c68db4e77b8b2961e927acc5a708ee260f/cli/src/ios/run.ts#L57

Alternatives

No response

Additional Information

This feature came to mind when I was debugging this issue: https://github.com/capawesome-team/capacitor-mlkit/issues/148.

JaapWeijland commented 7 months ago

My problem has been solved by the kind folks over at capawesome, however, I needed to edit the Podfile to make it work. This means I have to check in my ios folder, which I'd rather not do to make sure the ios and android configurations are automated (for example with Trapeze). Would it still make sense to add such a future for during development?

BeetrootToYourself commented 7 months ago

+1

therealjmj commented 7 months ago

My problem has been solved by the kind folks over at capawesome, however, I needed to edit the Podfile to make it work. This means I have to check in my ios folder, which I'd rather not do to make sure the ios and android configurations are automated (for example with Trapeze). Would it still make sense to add such a future for during development?

Podfile changes should be ok to commit to git, in my experience. You will have to make these modifications again if you ever remove the iOS platform and re-add it.

What specific changes did you add? I'm running into the same issue.

Also, will you be able to deploy to device? iOS devices run arm64.

JaapWeijland commented 7 months ago

The solution to my problem was posted here:

https://github.com/capawesome-team/capacitor-mlkit/issues/148

markemer commented 3 months ago

What Podfile changes did you need to make? Just adding SUPPORTED_ARCHS?