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 for web builds fail when const_update_2018 flag is turned on by default #37605

Closed
a-siva opened this issue Jul 23, 2019 · 4 comments · Fixed by flutter/engine#10069
Closed
Assignees
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. P0 A serious issue requiring immediate resolution web-dev-compiler
Milestone

Comments

@a-siva
Copy link
Contributor

a-siva commented Jul 23, 2019

The flutter for web engine builds fail with the following error when the const_update_2018 flag
is enabled. To reproduce checkout a flutter engine client and make local changes in
third_party/dart to enable const_update_2018 flag in the front end and try to build as follows
flutter/tools/gn --full-dart-sdk
ninja -C out/host_debug

This should trigger the error:

Command failed: /usr/local/google/home/asiva/workspace/flutter-roll/engine/src/t
hird_party/dart/tools/sdks/dart-sdk/bin/dart --packages=/usr/local/google/home/a
siva/workspace/flutter-roll/engine/src/third_party/dart/.packages --dfe=/usr/loc
al/google/home/asiva/workspace/flutter-roll/engine/src/third_party/dart/tools/sd
ks/dart-sdk/bin/snapshots/kernel-service.dart.snapshot /usr/local/google/home/as
iva/workspace/flutter-roll/engine/src/flutter/web_sdk/flutter_kernel_sdk.dart --
output=/usr/local/google/home/asiva/workspace/flutter-roll/engine/src/out/host_d
ebug/flutter_web_sdk/kernel/flutter_ddc_sdk.dill --libraries=/usr/local/google/h
ome/asiva/workspace/flutter-roll/engine/src/out/host_debug/flutter_web_sdk/libra
ries.json
output: Unhandled exception:
Unsupported operation: Encountered an unevaluated constant: #C3 = eval const dar
t.core::bool::fromEnvironment(#C1, defaultValue: #C2)

#0      ProgramCompiler.visitUnevaluatedConstant (package:dev_compiler/src/kerne
l/compiler.dart:5379:7)
#1      UnevaluatedConstant.accept (package:kernel/ast.dart:5898:34)
#2      ProgramCompiler.visitConstantExpression (package:dev_compiler/src/kernel
/compiler.dart:3783:21)
#3      ConstantExpression.accept (package:kernel/ast.dart:3785:36)
#4      ProgramCompiler._visitExpression (package:dev_compiler/src/kernel/compil
er.dart:3104:20)
#5      ProgramCompiler._visitInitializer (package:dev_compiler/src/kernel/compi
ler.dart:1564:11)
#6      ProgramCompiler._emitStaticFieldInitializer.<anonymous closure> (package
:dev_compiler/src/kernel/compiler.dart:2090:19)
#7      ProgramCompiler._withLetScope (package:dev_compiler/src/kernel/compiler.
dart:2098:25)
#8      ProgramCompiler._emitStaticFieldInitializer (package:dev_compiler/src/ke
rnel/compiler.dart:2088:22)
#9      ProgramCompiler._emitLazyFields (package:dev_compiler/src/kernel/compile
r.dart:2065:43)
#10     ProgramCompiler._emitTopLevelFields (package:dev_compiler/src/kernel/com
piler.dart:2051:21)
#11     ProgramCompiler._emitLibrary (package:dev_compiler/src/kernel/compiler.d
art:394:7)
#12     Iterable.forEach (dart:core/iterable.dart:277:30)
#13     ProgramCompiler.emitModule (package:dev_compiler/src/kernel/compiler.dar
t:298:15)
#14     main (file:///usr/local/google/home/asiva/workspace/flutter-roll/engine/
src/flutter/web_sdk/flutter_kernel_sdk.dart:79:11)
<asynchronous suspension>
#15     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart
:303:32)
#16     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dar
t:172:12)

[41/55] ACTION //third_party/dart/utils...t2js(//build/toolchain/linux:clang_x64
)
ninja: build stopped: subcommand failed.

@a-siva a-siva added P0 A serious issue requiring immediate resolution web-dev-compiler labels Jul 23, 2019
@a-siva a-siva added this to the D25 Release milestone Jul 23, 2019
@a-siva
Copy link
Contributor Author

a-siva commented Jul 23, 2019

Change needed to trigger the failure

diff --git a/pkg/front_end/lib/src/api_prototype/experimental_flags.dart b/pkg/front_end/lib/src/api_prototype/experimental_flags.dart
index 5c2f97e7c9..e7df869ee6 100644
--- a/pkg/front_end/lib/src/api_prototype/experimental_flags.dart
+++ b/pkg/front_end/lib/src/api_prototype/experimental_flags.dart
@@ -44,7 +44,7 @@ ExperimentalFlag parseExperimentalFlag(String flag) {
 }
 
 const Map<ExperimentalFlag, bool> defaultExperimentalFlags = {
-  ExperimentalFlag.constantUpdate2018: false,
+  ExperimentalFlag.constantUpdate2018: true,
   ExperimentalFlag.controlFlowCollections: true,
   ExperimentalFlag.extensionMethods: false,
   ExperimentalFlag.nonNullable: false,

@a-siva
Copy link
Contributor Author

a-siva commented Jul 23, 2019

/cc @johnniwinther

@a-siva
Copy link
Contributor Author

a-siva commented Jul 23, 2019

/cc @yjbanov

@vsmenon vsmenon added area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. area-front-end Use area-front-end for front end / CFE / kernel format related issues. labels Jul 23, 2019
dart-bot pushed a commit that referenced this issue Jul 23, 2019
… constant"

This reverts commit fd38424.

Temporarily disabling this to get Flutter roll going.  See
#37605

TBR=nshahan@google.com

Change-Id: I44dbb1d4aaf8d5f9cc05f096d26cade93a364f4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110120
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
@nshahan
Copy link
Contributor

nshahan commented Jul 23, 2019

I was able to repro this locally and have a fix locally that allows the build to complete. I will work on getting it landed ASAP.

nshahan added a commit to flutter/engine that referenced this issue Jul 23, 2019
Fixes: dart-lang/sdk#37605

We were seeing unevaluated constants during the build for flutter_web. Passing an empty map is handled differently than null so the constant evaluation will kick in.
dart-bot pushed a commit that referenced this issue Jul 24, 2019
… constant"

This reverts commit 62674b9.

Reason for revert: There is no reason we should ever encounter an unevaluated
constant in DDK and doing so implies there is an error in the constant evaluation.

We hope to find all such errors with this assertion. If this causes any more test
failures, feel free to revert this again and create an issue so we can fix.

A fix for the issue seen in the flutter-hhh bot has landed:
flutter/engine#10069

Original change's description:
> Revert "[dartdevc] Immediately throw when encountering an unevaluated constant"
>
> This reverts commit fd38424.
>
> Temporarily disabling this to get Flutter roll going.  See
> #37605
>
> TBR=nshahan@google.com
>
> Change-Id: I44dbb1d4aaf8d5f9cc05f096d26cade93a364f4c
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110120
> Reviewed-by: Vijay Menon <vsm@google.com>
> Commit-Queue: Vijay Menon <vsm@google.com>

TBR=vsm@google.com,nshahan@google.com

Change-Id: Ibcb719d3e6c0026b11a812bec853e158b338d51a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110185
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. P0 A serious issue requiring immediate resolution web-dev-compiler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants