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

Compilation Error during web publishing #55563

Closed
abhisiroha opened this issue Apr 24, 2024 · 2 comments
Closed

Compilation Error during web publishing #55563

abhisiroha opened this issue Apr 24, 2024 · 2 comments
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. closed-duplicate Closed in favor of an existing report web-js-interop Issues that impact all js interop

Comments

@abhisiroha
Copy link

abhisiroha commented Apr 24, 2024

OS - Windows 11
Flutter version - 3.19.1

Cause:- Compilation error during web publishing (working fine for Android devices)

This is a little urgent as I have to start user testing the app via the web before the deployment to playstore and appstore

Error below

Error: Command failed: flutter build web --web-renderer html --no-pub --no-version-check --no-tree-shake-icons
Target dart2js failed: ProcessException: Process exited abnormally with exit code 253:
/opt/.pub-cache/hosted/pub.dev/sensors_plus-5.0.1/lib/src/web_sensors_interop.dart:76:20:
Internal Error: Unknown external method j:method(SensorOptions|constructor#)
external factory SensorOptions({
^
The compiler is broken.

When compiling the above element, the compiler crashed. It is not
possible to tell if this is caused by a problem in your program or
not. Regardless, the compiler should not crash.

The Dart team would greatly appreciate if you would take a moment to
report this problem at http://dartbug.com/new.

Please include the following information:

  • the name and version of your operating system,

  • the Dart SDK build number (3.3.0), and

  • the entire message you see here (including the full stack trace
    below as well as the source location above).

The compiler crashed: Assertion failure: Unknown external method j:method(SensorOptions|constructor#)
#0      failedAt (package:compiler/src/diagnostics/invariant.dart:39:3)
#1      KernelSsaGraphBuilder._buildExternalFunctionNode (package:compiler/src/ssa/builder.dart:1825:5)
#2      KernelSsaGraphBuilder.build.<anonymous closure> (package:compiler/src/ssa/builder.dart:439:15)
#3      DiagnosticReporter.withCurrentElement (package:compiler/src/diagnostics/diagnostic_listener.dart:154:15)
#4      KernelSsaGraphBuilder.build (package:compiler/src/ssa/builder.dart:427:21)
#5      KernelSsaBuilder.build.<anonymous closure> (package:compiler/src/js_model/js_strategy.dart:525:22)
#6      CompilerTask.measure (package:compiler/src/common/tasks.dart:66:51)
#7      KernelSsaBuilder.build (package:compiler/src/js_model/js_strategy.dart:507:18)
#8      SsaBuilderTask.build (package:compiler/src/ssa/ssa.dart:365:21)
#9      SsaFunctionCompiler.compile (package:compiler/src/ssa/ssa.dart:99:28)
#10     OnDemandCodegenResults.getCodegenResults (package:compiler/src/common/codegen.dart:409:30)
#11     JsBackendStrategy.generateCode (package:compiler/src/js_model/js_strategy.dart:331:43)
#12     KernelCodegenWorkItem.run (package:compiler/src/js_model/js_strategy.dart:466:29)
#13     Compiler.emptyQueue.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:compiler/src/compiler.dart:752:70)
#14     CompilerTask.measureSubtask (package:compiler/src/common/tasks.dart:181:35)
#15     Compiler.emptyQueue.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:compiler/src/compiler.dart:752:32)
#16     CompilerTask.measureSubtask (package:compiler/src/common/tasks.dart:181:35)
#17     Compiler.emptyQueue.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:compiler/src/compiler.dart:750:28)
#18     DiagnosticReporter.withCurrentElement (package:compiler/src/diagnostics/diagnostic_listener.dart:154:15)
#19     Compiler.emptyQueue.<anonymous closure>.<anonymous closure> (package:compiler/src/compiler.dart:748:18)
#20     CodegenEnqueuer._forEach (package:compiler/src/js_backend/enqueuer.dart:266:12)
#21     CodegenEnqueuer.forEach (package:compiler/src/js_backend/enqueuer.dart:282:5)
#22     Compiler.emptyQueue.<anonymous closure> (package:compiler/src/compiler.dart:744:16)
#23     CompilerTask.measureSubtask (package:compiler/src/common/tasks.dart:181:35)
#24     Compiler.emptyQueue (package:compiler/src/compiler.dart:743:14)
#25     Compiler.processQueue.<anonymous closure> (package:compiler/src/compiler.dart:767:7)
#26     CompilerTask.measureSubtask (package:compiler/src/common/tasks.dart:181:35)
#27     Compiler.processQueue (package:compiler/src/compiler.dart:761:14)
#28     Compiler.runCodegenEnqueuer (package:compiler/src/compiler.dart:472:5)
  Command: /sdks/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev /sdks/flutter/bin/cache/dart-sdk/bin/snapshots/dart2js.dart.snapshot --platform-binaries=/sdks/flutter/bin/cache/flutter_web_sdk/kernel --invoker=flutter_tool -Ddart.vm.product=true -DFLUTTER_WEB_AUTO_DETECT=false -DFLUTTER_WEB_USE_SKIA=false -DFLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-canvaskit/04817c99c9fd4956f27505204f7e344335810aed/ --native-null-assertions --no-source-maps -O4 -o /tmp/ff_service_scratch/65Oa0QvabINIWhsCe99w/urbanflora/.dart_tool/flutter_build/97a1b05718bec35a2ce1d0104b22dca1/main.dart.js /tmp/ff_service_scratch/65Oa0QvabINIWhsCe99w/urbanflora/.dart_tool/flutter_build/97a1b05718bec35a2ce1d0104b22dca1/app.dill
#0      RunResult.throwException (package:flutter_tools/src/base/process.dart:127:5)

Error: Failed to compile application for the Web.

@dart-github-bot
Copy link
Collaborator

Item Details
Summary Compilation error during web publishing.
Triage to area-front-end, area-web

(what's this?)

@devoncarew devoncarew added the area-front-end Use area-front-end for front end / CFE / kernel format related issues. label Apr 25, 2024
@sigmundch
Copy link
Member

sigmundch commented Apr 26, 2024

Thanks for your report @abhisiroha

There was an issue with the Dart stable 3.3.0 SDK, which was then fixed in a patch release with Dart 3.3.1. The issue was that object-literal JS-interop constructors didn't work in dart2js unless the enclosing library had a @JS() annotation. Instead of reporting an error, the compiler crashed! This used to be required in the old interop, but we decided it shouldn't be required anymore, but then one part of the compiler wasn't adjusted to properly understand code without the annotation. More details available in the issue describing the 3.3.1 cherry-pick:
#55057

Since this is now released in the stable channel, most likely the only thing you need to do is to update to the latest stable release of Dart and Flutter.

@sigmundch sigmundch added closed-duplicate Closed in favor of an existing report web-js-interop Issues that impact all js interop area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. and removed area-front-end Use area-front-end for front end / CFE / kernel format related issues. labels Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. closed-duplicate Closed in favor of an existing report web-js-interop Issues that impact all js interop
Projects
None yet
Development

No branches or pull requests

4 participants