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

Is it possible to build on wasm? #182

Open
zeroexcuses opened this issue Jul 14, 2019 · 3 comments
Open

Is it possible to build on wasm? #182

zeroexcuses opened this issue Jul 14, 2019 · 3 comments

Comments

@zeroexcuses
Copy link

Is there any chance we can build python3-sys or rust-cpython with target = wasm32-unknown-unknown ?

I have a webapp built in Rust/wasm32, and I would like to be able to use Python3.7 as the scripting language for the Rust webapp.

I am getting error:

error: failed to run custom build command for `python3-sys v0.2.1`

--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "failed to run python interpreter `\"python\" \"-c\" \"import sys; import sysconfig; print(sys.executable); print(sys.version_info[0:2]); print(sysconfig.get_config_var(\\\'LIBDIR\\\')); print(sysconfig.get_config_var(\\\'Py_ENABLE_SHARED\\\')); print(sysconfig.get_config_var(\\\'LDVERSION\\\') or \\\'%s%s\\\' % (sysconfig.get_config_var(\\\'py_version_short\\\'), sysconfig.get_config_var(\\\'DEBUG_EXT\\\') or \\\'\\\')); print(sys.exec_prefix);\"`: No such file or directory (os error 2)"', src/libcore/result.rs:1051:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
@rafaelcaricio
Copy link

I'm not maintainer of this project. But I have interest on the idea you have and I have tried a few things. But cpython relies on pthread.h which is not supported by wasm32. It might be supported in the wasm32-wasi target some time in the future.

@rrader
Copy link

rrader commented Feb 19, 2021

@rafaelcaricio https://developers.google.com/web/updates/2018/10/wasm-threads it looks like pthread is kind of supported, at least in Chrome

@dgrunwald
Copy link
Owner

The python3-sys build script asks your currently installed python interpreter for its compilation flags, so that python3-sys can be compiled with a compatible ABI. That approach won't really work when cross-compiling.
You'll need to adjust the build script and figure out some other way of detecting the relevant flags (maybe just hardcode them?).

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