flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
166.25k stars 27.51k forks source link

Flutter AOT precompiler crash #79441

Closed vaind closed 3 years ago

vaind commented 3 years ago

Steps to Reproduce

  1. flutter create errorful
  2. change lib/main.dart contents to https://gist.github.com/vaind/2ffd8c8bde7e2d0bd1fc9559cbdfb3be
  3. change pubspec.yaml min SDK version to 2.12 to enable null-safety
  4. flutter build apk --release

you get ../../third_party/dart/runtime/vm/compiler/aot/precompiler.cc: 2761: error: unreachable code

Logs

Logs ``` Running "flutter pub get" in errorful... 390ms 💪 Building with sound null safety 💪 ../../third_party/dart/runtime/vm/compiler/aot/precompiler.cc: 2761: error: unreachable code Dart snapshot generator failed with exit code -6 FAILURE: Build failed with an exception. * Where: Script '/home/ivan/lib/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 991 * What went wrong: Execution failed for task ':app:compileFlutterBuildRelease'. > Process 'command '/home/ivan/lib/flutter/bin/flutter'' finished with non-zero exit value 1 * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 3s Running Gradle task 'assembleRelease'... Running Gradle task 'assembleRelease'... Done 3.6s Gradle task assembleRelease failed with exit code 1 ``` ``` [✓] Flutter (Channel stable, 2.0.3, on Linux, locale en_US.UTF-8) • Flutter version 2.0.3 at /home/ivan/lib/flutter • Framework revision 4d7946a68d (12 days ago), 2021-03-18 17:24:33 -0700 • Engine revision 3459eb2436 • Dart version 2.12.2 ```
mraleph commented 3 years ago

Seems like we are stuck in speculation loop in one of the functions. @alexmarkov could you take a look?

TahaTesser commented 3 years ago

Hi @vaind I can confirm it

logs ```bash tahatesser@Tahas-MacBook-Pro errorful % flutterm build apk --release Running "flutter pub get" in errorful... 1,214ms 💪 Building with sound null safety 💪 ../../third_party/dart/runtime/vm/compiler/aot/precompiler.cc: 3177: error: unreachable code Dart snapshot generator failed with exit code -6 FAILURE: Build failed with an exception. * Where: Script '/Users/tahatesser/Code/flutter_master/packages/flutter_tools/gradle/flutter.gradle' line: 1029 * What went wrong: Execution failed for task ':app:compileFlutterBuildRelease'. > Process 'command '/Users/tahatesser/Code/flutter_master/bin/flutter'' finished with non-zero exit value 1 * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 47s Running Gradle task 'assembleRelease'... Running Gradle task 'assembleRelease'... Done 48.0s Gradle task assembleRelease failed with exit code 1 tahatesser@Tahas-MacBook-Pro errorful % ```
flutter doctor -v ```bash [✓] Flutter (Channel stable, 2.0.3, on macOS 11.2.3 20D91 darwin-x64, locale en-GB) • Flutter version 2.0.3 at /Users/tahatesser/Code/flutter_stable • Framework revision 4d7946a68d (13 days ago), 2021-03-18 17:24:33 -0700 • Engine revision 3459eb2436 • Dart version 2.12.2 [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at /Volumes/Extreme/SDK • Platform android-30, build-tools 30.0.3 • ANDROID_HOME = /Volumes/Extreme/SDK • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer • Xcode 12.4, Build version 12D4e • CocoaPods version 1.10.1 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 4.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 1.8.0_242-release-1644-b3-6915495) [✓] VS Code (version 1.54.3) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.20.0 [✓] Connected device (3 available) • iPhone 12 (mobile) • 83060656-28E7-44CD-801E-B11EC3EC89BA • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator) • macOS (desktop) • macos • darwin-x64 • macOS 11.2.3 20D91 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.114 • No issues found! ``` ```bash [✓] Flutter (Channel master, 2.1.0-13.0.pre.346, on macOS 11.2.3 20D91 darwin-x64, locale en-GB) • Flutter version 2.1.0-13.0.pre.346 at /Users/tahatesser/Code/flutter_master • Framework revision 8158b478d7 (9 hours ago), 2021-03-31 13:29:03 +0800 • Engine revision dbcbf69a57 • Dart version 2.13.0 (build 2.13.0-175.0.dev) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at /Volumes/Extreme/SDK • Platform android-30, build-tools 30.0.3 • ANDROID_HOME = /Volumes/Extreme/SDK • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer • Xcode 12.4, Build version 12D4e • CocoaPods version 1.10.1 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 4.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 1.8.0_242-release-1644-b3-6915495) [✓] VS Code (version 1.54.3) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.20.0 [✓] Connected device (3 available) • iPhone 12 (mobile) • 83060656-28E7-44CD-801E-B11EC3EC89BA • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator) • macOS (desktop) • macos • darwin-x64 • macOS 11.2.3 20D91 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.114 • No issues found! ```

Thanks for filing the issue!

alexmarkov commented 3 years ago

Fix: https://dart-review.googlesource.com/c/sdk/+/193824.

alexmarkov commented 3 years ago

The fix was rolled into Flutter in e5f75dbe0b03ab6912cb7c58110d70ff1d489d35.

github-actions[bot] commented 3 years ago

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.