Skip to content

Building flutter tool on ARM macOS host fails #42534

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

Closed
cbenhagen opened this issue Jun 30, 2020 · 10 comments
Closed

Building flutter tool on ARM macOS host fails #42534

cbenhagen opened this issue Jun 30, 2020 · 10 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@cbenhagen
Copy link
Contributor

Building flutter tool on ARM macOS host fails with:

Building flutter tool...
oah error: unhandled 16KB-unaligned mmap addr=0x0 len=0xdd28c0 offset=0x1000 prot=1 flags=2
/Users/ben/development/flutter/bin/internal/shared.sh: line 20:  1298 Trace/BPT trap: 5       "$PUB" upgrade "$VERBOSITY" --no-precompile
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (9 tries left)
@jmagman
Copy link

jmagman commented Jun 30, 2020

oah is Rosetta. I see old blogs and ebooks mentioning gdb --oah when debugging Power-PC on Intel.
Also https://www.insanelymac.com/forum/topic/262890-installing-rosetta-on-lion/

@mraleph
Copy link
Member

mraleph commented Jun 30, 2020

I'd guess this happens when we try to load app-jit snapshot for the kernel service. ARM64 Mac OS has 16KB pages, and apparently our app-jit snapshot loading code expects 4KB pages. mmap is supposed to return EINVAL though if offset is not a multiple of page size.

/cc @rmacnak-google

@mraleph mraleph added the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label Jun 30, 2020
@Livinglist
Copy link

Livinglist commented Jul 3, 2020

same issue. on Mac using A12Z chip.

Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (2 tries left)
oah error: unhandled 16KB-unaligned mmap addr=0x0 len=0xdd3230 offset=0x1000 prot=1 flags=2
/Users/jiaqifeng/Dev/flutter/bin/internal/shared.sh: line 20:  1929 Trace/BPT trap: 5       "$PUB" upgrade "$VERBOSITY" --no-precompile

dart-bot pushed a commit that referenced this issue Jul 6, 2020
This accounts for the larger alignment required by mmap on ARM macOS.

Bug: #42534
Change-Id: Ie58732924d5a7287f2736696a6db0ddce7d308c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153382
Commit-Queue: Ryan Macnak <[email protected]>
Reviewed-by: Régis Crelier <[email protected]>
@MichelMelhem
Copy link

When does this fix will be applied to flutter ? I am running into the same issue

@jmagman
Copy link

jmagman commented Oct 27, 2020

935b69e rolled in flutter/engine#19577 which rolled in flutter/flutter#61090 which is in Flutter 1.20.0-7.0.pre. So that's in the stable channel.
@MichelMelhem what's the output of flutter doctor -v where you are seeing this?

@MichelMelhem
Copy link

@jmagman When running flutter doctor -v I'm getting this output :

 flutter doctor -v
Building flutter tool...
rosetta error: unhandled 16KB-unaligned mmap addr=0x0 len=0xcde1c0 offset=0x1000 prot=1 flags=2
/Users/michel/developement/flutter/bin/flutter: line 42: 19849 Trace/BPT trap: 5       "$PUB" upgrade "$VERBOSITY" --no-precompile
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (9 tries left)
rosetta error: unhandled 16KB-unaligned mmap addr=0x0 len=0xcde1c0 offset=0x1000 prot=1 flags=2
/Users/michel/developement/flutter/bin/flutter: line 42: 19854 Trace/BPT trap: 5       "$PUB" upgrade "$VERBOSITY" --no-precompile
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (8 tries left)
rosetta error: unhandled 16KB-unaligned mmap addr=0x0 len=0xcde1c0 offset=0x1000 prot=1 flags=2
/Users/michel/developement/flutter/bin/flutter: line 42: 19859 Trace/BPT trap: 5       "$PUB" upgrade "$VERBOSITY" --no-precompile
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (7 tries left)
rosetta error: unhandled 16KB-unaligned mmap addr=0x0 len=0xcde1c0 offset=0x1000 prot=1 flags=2
/Users/michel/developement/flutter/bin/flutter: line 42: 19864 Trace/BPT trap: 5       "$PUB" upgrade "$VERBOSITY" --no-precompile
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (6 tries left)

I'm running an apple dev kit that is using apple silicon.

@jmagman
Copy link

jmagman commented Oct 27, 2020

Do you know what version of Flutter are you on? I believe it should be fixed on the stable channel. I was just on a DTK where it was working on master, though I didn't try stable.

@jmagman
Copy link

jmagman commented Oct 27, 2020

In any case you will need to be on master to flutter run on a real device to pick up flutter/flutter#68855

@MichelMelhem
Copy link

@jmagman Update : I'm now able to successfully run flutter doctor but my app still won't compile running the same issue that was mentioned before:

Flutter run logs :

Downloading ios tools...                                            2.9s
Downloading ios-profile tools...                                    1.3s
Downloading ios-release tools...                                    8.5s
Running "flutter pub get" in bestreport...                         11.3s
Launching lib/main.dart on iPhone 11 in debug mode...
 
Running pod install...                                             18.8s
Running Xcode build...                                                  
Xcode build done.                                           28.5s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    rosetta error: unhandled 16KB-unaligned mmap addr=0x0 len=0x21f48a0 offset=0x1000 prot=1 flags=2
    clang: error: unable to execute command: Trace/BPT trap: 5
    clang: error: linker command failed due to signal (use -v to see invocation)
    Command Ld failed with a nonzero exit code
    rosetta error: unhandled 16KB-unaligned mmap addr=0x0 len=0x21f48a0 offset=0x1000 prot=1 flags=2
    clang: error: unable to execute command: Trace/BPT trap: 5
    clang: error: linker command failed due to signal (use -v to see invocation)
    Command Ld failed with a nonzero exit code
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description

Flutter doctor -v output :

michel@iMac-de-Michel bestreport % flutter doctor -v
[✓] Flutter (Channel stable, 1.22.2, on macOS 11.0 20A5395g, locale en-FR)
    • Flutter version 1.22.2 at /Users/michel/developement/flutter
    • Framework revision 84f3d28555 (12 days ago), 2020-10-15 16:26:19 -0700
    • Engine revision b8752bbfff
    • Dart version 2.10.2


[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/michel/Library/Android/sdk
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Users/michel/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/192.6392135/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.1, Build version 12A7403
    • CocoaPods version 1.9.1

[!] Android Studio (version 3.6)
    • Android Studio at /Users/michel/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/192.6392135/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[!] IntelliJ IDEA Ultimate Edition (version 2019.3.4)
    • IntelliJ at /Users/michel/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[!] VS Code (version 1.49.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (1 available)
    • iPhone 11 (mobile) • 02132D76-EFC8-49C3-96E5-A11847E4394D • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)

! Doctor found issues in 3 categories.

@jmagman
Copy link

jmagman commented Oct 27, 2020

@MichelMelhem Apple Silicon isn't fully supported for Flutter yet, even on the master channel. And definitely not on the stable channel. We're tracking with flutter/flutter#60118. If you encounter issues that aren't on that list, please file a new issue in the flutter/flutter repo and we can take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

6 participants