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

add support for wasm32-wasi #245

Merged
merged 6 commits into from
Feb 9, 2024
Merged

add support for wasm32-wasi #245

merged 6 commits into from
Feb 9, 2024

Conversation

mmoskal
Copy link
Contributor

@mmoskal mmoskal commented Jan 10, 2024

This makes build.rs download wasi-sys if building for wasm32-wasi target. The logic is copied from https://github.com/bytecodealliance/javy/blob/main/crates/quickjs-wasm-sys/build.rs

I was unable to get the bindgen to work - it would not output functions (it would output types and constants correctly though). In the end I copied the bindgen file from i686-msvc. It works OK.

Copy link
Owner

@DelSkayn DelSkayn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good apart from one minor change in a println.

sys/build.rs Outdated Show resolved Hide resolved
@DelSkayn
Copy link
Owner

Thanks for the PR!

I have also been experimenting with adding support for wasi. I thought I managed at one point to get bindgen working, so I will do some testing with that before merging this.

sys/build.rs Outdated Show resolved Hide resolved
@mmoskal mmoskal requested a review from DelSkayn January 11, 2024 17:37
@dejang
Copy link

dejang commented Feb 9, 2024

Really appreciate the work done here, do you know how we could make this work for the web ? I'm really curios about that. I' m currently working on a project where I'm in need of an isolated environment that is not an iframe or worker and QuickJS fits perfectly.

@DelSkayn DelSkayn merged commit f2cad8e into DelSkayn:master Feb 9, 2024
27 checks passed
@DelSkayn
Copy link
Owner

DelSkayn commented Feb 9, 2024

@dejang the problem with compiling quickjs for web wasm is that there are currently some problems with packaging c libraries which require libc. The default wasm target used by rust is wasm-unknown-unknown which doesn't have a libc available. We could instead add support for wasm-emscripten but this requires a lot of code just to pull in the sdk or check for it's availability for a platform which isn't well supported by rust tools like wasm-bindgen.

For more reference see rustwasm/team#291

@dejang
Copy link

dejang commented Feb 9, 2024

Thank you @DelSkayn, that actually makes a lot of sense.

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

Successfully merging this pull request may close these issues.

3 participants