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

Error: 'dart:ffi' can't be imported when compiling to Wasm #263

Closed
redDwarf03 opened this issue Jun 27, 2024 · 2 comments
Closed

Error: 'dart:ffi' can't be imported when compiling to Wasm #263

redDwarf03 opened this issue Jun 27, 2024 · 2 comments

Comments

@redDwarf03
Copy link

Hello

i try to compile a flutter web project but:

flutter build web --wasm

┌─ New feature ────────────────────────────────────────────────────────────────────────────┐
│   WebAssembly compilation is new. Understand the details before deploying to production. │
│   See https://flutter.dev/wasm for more information.                                     │
└──────────────────────────────────────────────────────────────────────────────────────────┘

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.


../../../flutter/.pub-cache/hosted/pub.dev/ffi-2.1.2/lib/src/allocation.dart:5:1: Error: 'dart:ffi' can't be imported when compiling to Wasm.
import 'dart:ffi';
^
../../../flutter/.pub-cache/hosted/pub.dev/ffi-2.1.2/lib/src/utf16.dart:5:1: Error: 'dart:ffi' can't be imported when compiling to Wasm.
import 'dart:ffi';
^
../../../flutter/.pub-cache/hosted/pub.dev/ffi-2.1.2/lib/src/utf8.dart:6:1: Error: 'dart:ffi' can't be imported when compiling to Wasm.
import 'dart:ffi';
^
../../../flutter/.pub-cache/hosted/pub.dev/ffi-2.1.2/lib/src/arena.dart:8:1: Error: 'dart:ffi' can't be imported when compiling to Wasm.
import 'dart:ffi';
^
../../../flutter/.pub-cache/hosted/pub.dev/cryptography-2.7.0/lib/src/dart/argon2_impl_vm.dart:16:1: Error: 'dart:ffi' can't be imported when compiling
to Wasm.
import 'dart:ffi';
^
../../../flutter/.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;
^
../../../flutter/.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;

Flutter doctor -v

[✓] Flutter (Channel stable, 3.22.2, on macOS 14.5 23F79 darwin-arm64, locale fr-FR)
    • Flutter version 3.22.2 on channel stable at /Users/SSe/.asdf/installs/flutter/3.22.2-stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 761747bfc5 (3 weeks ago), 2024-06-05 22:15:13 +0200
    • Engine revision edd8546116
    • Dart version 3.4.3
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/SSe/Library/Android/sdk
    • Platform android-34, build-tools 33.0.1
    • ANDROID_HOME = /Users/SSe/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.2)
    • 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 17.0.9+0-17.0.9b1087.7-11185874)

[✓] VS Code (version 1.90.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.90.0

[✓] Connected device (3 available)
    • macOS (desktop)                 • macos                 • darwin-arm64   • macOS 14.5 23F79 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         • macOS 14.5 23F79 darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript • Google Chrome 126.0.6478.127
  

[✓] Network resources
    • All expected network resources are available.
@srujzs
Copy link
Contributor

srujzs commented Jun 27, 2024

Consider filing this in the Flutter repo instead as it's unrelated to package:web and they might be able to assist you better.

https://github.com/flutter/flutter

@srujzs srujzs closed this as not planned Won't fix, can't repro, duplicate, stale Jun 27, 2024
@parlough
Copy link
Member

Note that importing dart:ffi when compiling to Wasm was not supported and after dart-lang/sdk#55979 is disallowed. dart-lang/sdk#55948 (comment) has some more details.

As for the specific issue it seems you are facing, I believe it's being tracked in dnfield/vector_graphics#244.

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

3 participants