Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flutter build ipa fails after migration to new MacBook, latest Xcode #140777

Closed
bryonnicoson opened this issue Jan 1, 2024 · 9 comments
Closed
Labels
in triage Presently being triaged by the triage team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds

Comments

@bryonnicoson
Copy link

Steps to reproduce

Build completes on MacBook Pro with Intel chip running macOS 12.7.1 and Xcode 13.4.1.
Build fails on MacBook Air with Apple M2 chip running macOS 14.2.1 and Xcode 15.1.

Expected results

Successful build

Actual results

Build fails

Code sample

Code sample
bryonnicoson@Bryons-Air wishbone % flutter build ipa

Archiving org.wishbonecaninerescue...
Automatically signing iOS for device deployment using specified development team
in Xcode project: Y7SP32JD57
Running Xcode build...                                                  
Xcode archive done.                                         10.7s
Failed to build iOS app
Error (Xcode): Target aot_assembly_release failed: Exception: Flutter failed to
run
"/Users/bryonnicoson/development/flutter/bin/cache/artifacts/engine/ios-release/
gen_snapshot_arm64 --deterministic --snapshot_kind=app-aot-assembly
--assembly=/Users/bryonnicoson/projects/wishbone/.dart_tool/flutter_build/3845b4
145dcae82f344df65f7b356936/arm64/snapshot_assembly.S
/Users/bryonnicoson/projects/wishbone/.dart_tool/flutter_build/3845b4145dcae82f3
44df65f7b356936/app.dill".


Encountered error while archiving for device.
bryonnicoson@Bryons-Air wishbone % 

Screenshots or Video

Screenshots / Video demonstration Screenshot 2024-01-01 at 11 07 30 AM

Logs

Logs
bryonnicoson@Bryons-Air wishbone % flutter build ipa

Archiving org.wishbonecaninerescue...
Automatically signing iOS for device deployment using specified development team
in Xcode project: Y7SP32JD57
Running Xcode build...                                                  
Xcode archive done.                                         10.7s
Failed to build iOS app
Error (Xcode): Target aot_assembly_release failed: Exception: Flutter failed to
run
"/Users/bryonnicoson/development/flutter/bin/cache/artifacts/engine/ios-release/
gen_snapshot_arm64 --deterministic --snapshot_kind=app-aot-assembly
--assembly=/Users/bryonnicoson/projects/wishbone/.dart_tool/flutter_build/3845b4
145dcae82f344df65f7b356936/arm64/snapshot_assembly.S
/Users/bryonnicoson/projects/wishbone/.dart_tool/flutter_build/3845b4145dcae82f3
44df65f7b356936/app.dill".


Encountered error while archiving for device.
bryonnicoson@Bryons-Air wishbone % 

Flutter Doctor output

Doctor output
bryonnicoson@Bryons-Air wishbone % flutter doctor -v
[✓] Flutter (Channel stable, 3.16.5, on macOS 14.2.1 23C71 darwin-arm64, locale
    en-US)
    • Flutter version 3.16.5 on channel stable at
      /Users/bryonnicoson/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 78666c8dc5 (13 days ago), 2023-12-19 16:14:14 -0800
    • Engine revision 3f3e560236
    • Dart version 3.2.3
    • DevTools version 2.28.4

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/bryonnicoson/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C65
    • CocoaPods version 1.14.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      17.0.7+0-17.0.7b1000.6-10550314)

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 14.2.1 23C71
      darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 120.0.6099.129

[✓] Network resources
    • All expected network resources are available.

• No issues found!
bryonnicoson@Bryons-Air wishbone % 
@huycozy huycozy added the in triage Presently being triaged by the triage team label Jan 2, 2024
@AlexDochioiu
Copy link

Uninstall xcode and install it again. I believe I had similar issues with xcode after migrating a intel macbook to m1. Don't think it's a flutter issue.

After you re-install XCode. Try to open the project and do a product > archive directly from xcode once.

@huycozy
Copy link
Member

huycozy commented Jan 2, 2024

@bryonnicoson Can you please share the entire output of flutter build ipa -v?

Also, this looks similar to #139500, please check #139500 (comment) to see if it helps.

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 2, 2024
@mraleph
Copy link
Member

mraleph commented Jan 3, 2024

I think you need to have Rosetta installed.

@stuartmorgan @zanderso do you know what is the story with build artifacts for ARM Macs? I thought we have disentangled ourselves from Rosetta, but it does not seem to be the case:

$ file bin/cache/artifacts/engine/ios-release/gen_snapshot_arm64
bin/cache/artifacts/engine/ios-release/gen_snapshot_arm64: Mach-O 64-bit executable x86_64
$ find bin/cache/artifacts -iname 'gen_snapshot*' -exec file '{}' ';'
bin/cache/artifacts/engine/android-arm-release/darwin-x64/gen_snapshot: Mach-O 64-bit executable x86_64
bin/cache/artifacts/engine/ios-profile/gen_snapshot_arm64: Mach-O 64-bit executable x86_64
bin/cache/artifacts/engine/darwin-x64-profile/gen_snapshot_arm64: Mach-O 64-bit executable x86_64
bin/cache/artifacts/engine/darwin-x64-profile/gen_snapshot_x64: Mach-O 64-bit executable x86_64
bin/cache/artifacts/engine/darwin-x64-profile/gen_snapshot: Mach-O 64-bit executable x86_64
bin/cache/artifacts/engine/darwin-x64/gen_snapshot_arm64: Mach-O 64-bit executable x86_64
bin/cache/artifacts/engine/darwin-x64/gen_snapshot_x64: Mach-O 64-bit executable x86_64
bin/cache/artifacts/engine/darwin-x64/gen_snapshot: Mach-O 64-bit executable arm64
bin/cache/artifacts/engine/android-x64-profile/darwin-x64/gen_snapshot: Mach-O 64-bit executable x86_64
bin/cache/artifacts/engine/android-arm64-release/darwin-x64/gen_snapshot: Mach-O 64-bit executable x86_64
bin/cache/artifacts/engine/ios/gen_snapshot_arm64: Mach-O 64-bit executable x86_64
bin/cache/artifacts/engine/android-arm64-profile/darwin-x64/gen_snapshot: Mach-O 64-bit executable x86_64
bin/cache/artifacts/engine/android-x64-release/darwin-x64/gen_snapshot: Mach-O 64-bit executable x86_64
bin/cache/artifacts/engine/ios-release/gen_snapshot_arm64: Mach-O 64-bit executable x86_64
bin/cache/artifacts/engine/darwin-x64-release/gen_snapshot_arm64: Mach-O 64-bit executable x86_64
bin/cache/artifacts/engine/darwin-x64-release/gen_snapshot_x64: Mach-O 64-bit executable x86_64
bin/cache/artifacts/engine/darwin-x64-release/gen_snapshot: Mach-O 64-bit executable x86_64
bin/cache/artifacts/engine/android-arm-profile/darwin-x64/gen_snapshot: Mach-O 64-bit executable x86_64

I would think that we should only use ARM64 binaries on ARM Macs and not expect users to have Rosetta installed. I also find it puzzling that we have some duplication:

$ bin/cache/artifacts/engine/darwin-x64/gen_snapshot_arm64: Mach-O 64-bit executable x86_64
$ bin/cache/artifacts/engine/darwin-x64/gen_snapshot_x64: Mach-O 64-bit executable x86_64
$ bin/cache/artifacts/engine/darwin-x64/gen_snapshot: Mach-O 64-bit executable arm64

Why do we have 3 gen_shapshot, 2 of which are using the same host arch (which is also wrong for the current host)?

@mraleph
Copy link
Member

mraleph commented Jan 3, 2024

also cc @jmagman

@zanderso
Copy link
Member

zanderso commented Jan 3, 2024

Is it possible to build gen_snapshot for arm64 such that it can generate x64 snapshots? If so, then that has not yet been integrated into the Flutter Engine build.

@jmagman
Copy link
Member

jmagman commented Jan 3, 2024

@bryonnicoson 1. Do you know if you installed Rosetta? 2. Can you run build ipa again with the --verbose flag and attach the output? It's large.

If Rosetta isn't installed the doctor should be complaining that gen_snapshot_arm64 can't be run. #114558

if (_fileSystem.file(genSnapshotPath).existsSync() && !_genSnapshotRuns(genSnapshotPath)) {

} else if (_platform.isMacOS && _operatingSystemUtils.hostPlatform == HostPlatform.darwin_arm64) {
buffer.writeln('Flutter requires the Rosetta translation environment on ARM Macs. Try running:');
buffer.writeln(' sudo softwareupdate --install-rosetta --agree-to-license');
}

do you know what is the story with build artifacts for ARM Macs?

@cbracken has been working on parts of it #103386 and #101138

Tooling bits #69157 blocked on infra #121178

@jmagman
Copy link
Member

jmagman commented Jan 4, 2024

Is it possible to build gen_snapshot for arm64 such that it can generate x64 snapshots? If so, then that has not yet been integrated into the Flutter Engine build.

@zanderso I believe that was done awhile ago dart-lang/sdk#49768 and dart-lang/sdk@4f7bb16

Copy link

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now.
If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones.
Thanks for your contribution.

Copy link

github-actions bot commented Feb 6, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
in triage Presently being triaged by the triage team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds
Projects
None yet
Development

No branches or pull requests

6 participants