-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Dart2Wasm compiler fails building when dart:ffi library is conditionally imported #55948
Comments
This is a known issue and comes due to the fact that the library We could avoid this issue if we made it an internal library (i.e. The conditional import mechanism works in the earlier stages than the backend mechanism that disallows importing certain (somewhat existing) libraries. We could investigate whether we can do that part earlier in the pipeline (/cc @osa1) Using |
…nditional imports Users of packages that have specialized code for the VM (which supports FFI) use conditional imports based on `dart.library.ffi`. We don't want the VM-specific code to be used for web in dart2wasm. As a result we're going to make `dart.library.ffi` be false in coditional imports (as well as in `const bool.fromEnvironment('dart.library.ffi')`. Issue dart-lang/sdk#55948 Issue flutter/flutter#149984
…nditional imports (#53307) Users of packages that have specialized code for the VM (which supports FFI) use conditional imports based on `dart.library.ffi`. We don't want the VM-specific code to be used for web in dart2wasm. As a result we're going to make `dart.library.ffi` be false in conditional imports (as well as in `const bool.fromEnvironment('dart.library.ffi')`). Issue dart-lang/sdk#55948 Issue flutter/flutter#149984
I've made a few changes that will make us be able to evaluate the conditional import correctly (and thereby |
…ary.ffi` This is a follow-up to [0]. That CL changed dart2wasm's modular transformer to issue an error if `dart:ffi` is imported. Users of packages that have specialized code for the VM (which supports FFI) use conditional imports based on `dart.library.ffi`. We don't want the VM-specific code to be used for web in dart2wasm (as dart2wasm doesn't support the entirety of `dart:ffi`). As a result we're going to make `dart.library.ffi` be false in coditional imports (as well as in `const bool.fromEnvironment('dart.library.ffi')`). [0] https://dart-review.googlesource.com/c/sdk/+/368568 Issue #55948 Issue flutter/flutter#149984 Change-Id: I70a775278ab701d1fd2596521e378cb6364edac2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370580 Commit-Queue: Martin Kustermann <[email protected]> Reviewed-by: Srujan Gaddam <[email protected]>
The CL landed and will make it's way up to flutter main channel in the coming days. In the meantime I've filed for a cherry-pick request to stable channel in Issue 55979 |
…dart.library.ffi` This is a follow-up to [0]. That CL changed dart2wasm's modular transformer to issue an error if `dart:ffi` is imported. Users of packages that have specialized code for the VM (which supports FFI) use conditional imports based on `dart.library.ffi`. We don't want the VM-specific code to be used for web in dart2wasm (as dart2wasm doesn't support the entirety of `dart:ffi`). As a result we're going to make `dart.library.ffi` be false in coditional imports (as well as in `const bool.fromEnvironment('dart.library.ffi')`). [0] https://dart-review.googlesource.com/c/sdk/+/368568 Bug: #55948 Bug: flutter/flutter#149984 Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/370580 Cherry-pick-request: #55979 Change-Id: Ia968bacf92566d421606fc026c7f016fe5abff01 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370880 Reviewed-by: Slava Egorov <[email protected]>
The fix for the conditional imports should be available in latest It seems that flutter may not do hot fix releases on stable channel for 1-2 weeks, so it may take time until it arrives there. |
@mkustermann Hello, can we rollback the local flutter version to avoid this issue? And whick version flutter can we rollback to? |
Due to incomplete and unstable ffi in dart2wasm we made two changes, here's the commits and how they rolled:
So you can use versions of flutter before those if you really want to. But there's a reason we have disallowed it, so I can discourage relying on it until we have a properly working FFI for the web. |
I'm a bit lost. I get the following error:
What can I do to fix this issue ? |
You have to build current flutter from git on your own. Or wait for the fix to be in the next version. |
This particular issue in That being said, |
/cc @kevmoo (see above) |
See also dnfield/vector_graphics#244
…On Mon, Jun 17, 2024 at 11:31 AM Martin Kustermann ***@***.***> wrote:
/cc @kevmoo <https://github.com/kevmoo> (see above)
—
Reply to this email directly, view it on GitHub
<#55948 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAEFCQSWJW52FETKHDOUTTZH4TOVAVCNFSM6AAAAABI4MTWZ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZUGEYTSNBWGE>
.
You are receiving this because you were mentioned.Message ID:
<dart-lang/sdk/issues/55948/2174119461 ***@***.***>
|
@mkustermann I try using |
But this issue fixed in 3.22.1 |
Please see my response here: flutter/flutter#149984 (comment) Locking this issue for more comments due to
|
When compiling a simple flutter project in wasm using the latest dart stable version, the compiler will refuse building once a library that conditionally imports "dart:ffi" is imported and used.
simple steps to reproduce
main.dart:
e.dart:
e_stub.dart:
e_ffi.dart:
interestingly enough, if the e.dart file is rewritten like this...
e.dart:
...the compiler doesn't complain
The text was updated successfully, but these errors were encountered: