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

Issue with Wasm Compilation: dart:ffi Not Supported #1084

Open
YawarOsman opened this issue Jun 25, 2024 · 4 comments
Open

Issue with Wasm Compilation: dart:ffi Not Supported #1084

YawarOsman opened this issue Jun 25, 2024 · 4 comments

Comments

@YawarOsman
Copy link

YawarOsman commented Jun 25, 2024

I have just used the package in my web app but it just don't support wasm:


Target dart2wasm failed: ProcessException: Process exited abnormally with exit code 64:
*NOTE*: Compilation to WasmGC is experimental.
The support may change, or be removed, with no advance notice.


../../../../.pub-cache/hosted/pub.dev/vector_graphics_compiler-1.1.11+1/lib/src/svg/_tessellator_ffi.dart:6:1: Error: 'dart:ffi' can't be imported when compiling to Wasm.
import 'dart:ffi' as ffi;
^
../../../../.pub-cache/hosted/pub.dev/vector_graphics_compiler-1.1.11+1/lib/src/svg/_path_ops_ffi.dart:6:1: Error: 'dart:ffi' can't be imported when compiling to Wasm.
import 'dart:ffi' as ffi;
^
  Command: /Users/yara/Development/flutter/bin/cache/dart-sdk/bin/dart compile wasm --packages=.dart_tool/package_config.json --extra-compiler-option=--dart-sdk=/Users/yara/Development/flutter/bin/cache/dart-sdk
  --extra-compiler-option=--platform=/Users/yara/Development/flutter/bin/cache/flutter_web_sdk/kernel/dart2wasm_platform.dill --extra-compiler-option=--delete-tostring-package-uri=dart:ui --extra-compiler-option=--delete-tostring-package-uri=package:flutter
  --extra-compiler-option=--import-shared-memory --extra-compiler-option=--shared-memory-max-pages=32768 -Ddart.vm.product=true -DFLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-canvaskit/edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4/ -DFLUTTER_WEB_AUTO_DETECT=false -DFLUTTER_WEB_USE_SKIA=false
  -DFLUTTER_WEB_USE_SKWASM=true --extra-compiler-option=--depfile=/Users/yara/Desktop/work/POS/pos_admin_panel/.dart_tool/flutter_build/a91501fadcce71a69bcbc5d40dfdd285/dart2wasm.d -O4 --no-name-section -o
  /Users/yara/Desktop/work/POS/pos_admin_panel/.dart_tool/flutter_build/a91501fadcce71a69bcbc5d40dfdd285/main.dart.wasm /Users/yara/Desktop/work/POS/pos_admin_panel/.dart_tool/flutter_build/a91501fadcce71a69bcbc5d40dfdd285/main.dart
#0      RunResult.throwException (package:flutter_tools/src/base/process.dart:125:5)
#1      _DefaultProcessUtils.run (package:flutter_tools/src/base/process.dart:321:19)
<asynchronous suspension>
#2      Dart2WasmTarget.build (package:flutter_tools/src/build_system/targets/web.dart:329:5)
<asynchronous suspension>
#3      _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:875:9)
<asynchronous suspension>
#4      Future.wait.<anonymous closure> (dart:async/future.dart:524:21)
<asynchronous suspension>
#5      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:813:32)
<asynchronous suspension>
#6      Future.wait.<anonymous closure> (dart:async/future.dart:524:21)
<asynchronous suspension>
#7      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:813:32)
<asynchronous suspension>
#8      FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:642:16)
<asynchronous suspension>
#9      WebBuilder.buildWeb (package:flutter_tools/src/web/compile.dart:92:34)
<asynchronous suspension>
#10     BuildWebCommand.runCommand (package:flutter_tools/src/commands/build_web.dart:230:5)
<asynchronous suspension>
#11     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1394:27)
<asynchronous suspension>
#12     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#13     CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#14     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:372:9)
<asynchronous suspension>
#15     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#16     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:308:5)
<asynchronous suspension>
#17     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:130:9)
<asynchronous suspension>
#18     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#19     main (package:flutter_tools/executable.dart:93:3)
<asynchronous suspension>

Compiling lib/main.dart for the Web...                             88.8s
Error: Failed to compile application for the Web.

@YawarOsman YawarOsman changed the title Don't support wasm Issue with Wasm Compilation: dart:ffi Not Supported Jun 25, 2024
@adifyr
Copy link

adifyr commented Jun 26, 2024

See also: dart-lang/sdk#55948 (comment). The vector_graphics_compiler may have other issues with WebAssembly compilation due to it conditionally importing dart:html libraries.

@nohli
Copy link
Contributor

nohli commented Jun 27, 2024

You can try this fix

dnfield/vector_graphics#244 (comment)

@shrawank039
Copy link

Some dart libraries dart:ffi / dart:js / dart:js_util, etc are not allowed in the latest flutter and dart SDK. You can avoid this issue by downgrading your Flutter SDK.

for more details - dart-lang/sdk#55948 (comment)

@YawarOsman
Copy link
Author

Some dart libraries dart:ffi / dart:js / dart:js_util, etc are not allowed in the latest flutter and dart SDK. You can avoid this issue by downgrading your Flutter SDK.

for more details - dart-lang/sdk#55948 (comment)

The reason I want to resolve this issue is to ensure we can use the latest version rather than downgrading. Downgrading is merely evading the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants