-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Directly Compiling RustPython to WASM #5358
Comments
How about wasm32-unknown-unknown or wasm32-wasi? |
As i know, wasm32-unknown-emscripten is not being maintained for long time |
Trying to wasm32-unknown-unknown still produces errors (though far less).
These errors appear whether I am using the nightly build of rust or not. I am not sure it's possible to use wasm-unknown-unknown as I need |
Fyi, there is a WASM-compat module in It is built to run on the web and is, e.g., the backend of the web demo for RustPython: https://rustpython.github.io/demo/ I've made an example of this with an editor at https://playground.cobalt.rocks/interactive/?s=grade_calculator.py. The module builds fine with |
I was looking for a more unified build (as I'd love to build this for desktop as well), but deploying it with a JS bridge to the WASM module on web will work perfectly fine. As for the @Chaostheorie thank you! |
@Chaostheorie Thank you! The website looks great! |
@Luzzotica Oh, if you are using published version, please also try the git main branch |
Summary
I am trying to build the RustPython crate in my Godot application into WASM as I would like to export my project to web.
However, I get dozens of errors with the
nix
crate, as it is not have WASM support.I tried looking into using
cfg
to exclude nix usage from files if the target was WASM, but there are dozens of them, and I don't trust myself to do it right (I'm very new to rust).And I'm wondering if there's perhaps another, simpler way to approach it (as I saw multiple CFG's already in there based on platform).
Expected use case
I would like to be able to build my project for WASM using:
cargo build --target wasm32-unknown-emscripten
Technically I am using:
cargo nightly build -Zbuild-std --target wasm32-unknown-emscripten
As I need access to the -Z flag for access to the
link-native-libraries
, though I am hoping that either will work.I would expect this to build properly, without errors.
As a note, it looks like most of the
nix
usage is in stdlib, I will be looking into excluding that portion of the VM, as I know most of those things won't work on the web anyways (like reading files).The text was updated successfully, but these errors were encountered: