Xcode build fail on m1 chip

Viewed 836

I'm trying to build a flutter app in Xcode on my Mac (m1 chip). But it fails due to below error.

Command PhaseScriptExecution failed with a nonzero exit code

As the warning says, my guess is that the issue occur while it trying to build it for arm64. But I have already add aram64 in excluded arch list.

I'm running Xcode on rosetta & also its build successfully on iOS 12 & iOS 14 simulators but the issue comes when I try to build it on real device with iOS 14.3 and also in archive build. What I'm doing wrong here?

Error message

My changes in arch section

1 Answers
Command PhaseScriptExecution failed with a nonzero exit code

The error you've encountered could be due to many reasons. It would be better if you can isolate the issue by performing the workaround that was discussed in this GitHub post.

Sent here from: #76302

So I was having this issue after trying every flutter clean / podfile delete sequence under the sun. Turns out my flutter got stuck at an old version that is evidently not compatible with the latest version of xcode or something (who really knows).

So I had to run

  • flutter upgrade --force
  • flutter clean
  • delete Podfile and Podfile.lock
  • run pub get
  • re-run my build_runner stuff (you may not have this)
  • flutter run (to run the app on device with all this new stuff / regenerate podfile stuff)

Then I was finally able to get my ios archive to build with flutter build ipa.

FYI: The flutter upgrade command pushed me from 2.0.5 -> 2.2.1 on the stable channel. Prior to this, I was just getting generic warnings of Command PhaseScriptExecution failed with a nonzero exit code.

Related