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

WASM support #27

Closed
clbarnes opened this issue Jun 12, 2023 · 4 comments
Closed

WASM support #27

clbarnes opened this issue Jun 12, 2023 · 4 comments

Comments

@clbarnes
Copy link
Contributor

clbarnes commented Jun 12, 2023

By linking a C library, it's obviously harder to get blosc-rs to run in a browser. However, c-blosc itself can be compiled to WASM (see Blosc/c-blosc#238 (comment) and https://github.com/manzt/numcodecs.js/tree/main/codecs/blosc ). I don't know much about linking C libraries or WASM itself (other than running cargo build and praying...); is it possible to bake that kind of configuration into a build.rs and gain WASM support for blosc-sys? I gather the hard bit is the FFI between rust and C.

I suppose there could alternatively be a separate crate which generates a WASM blob as above and then writes a dependent rust wrapper around it with js_sys for API niceness.

@asomers
Copy link
Owner

asomers commented Jun 12, 2023

Wow, interesting idea. I don't know much about WASM, either. But my preferred approach would be your second suggestion: a separate crate to generate the WASM blob.

@kylebarron
Copy link

Most rust-wasm packages use the wasm32-unknown-unknown target instead of the wasm32-unknown-emscripten target, which is what you'd need to use if you have a C library. The tooling around the rust+emscripten bindings isn't very good rustwasm/team#291

@asomers
Copy link
Owner

asomers commented May 24, 2024

I'm going to close this issue because nobody seems to be working on it. And to be clear, I'm not going to do it myself; I know nothing about wasm or browsers. But I can help you with the blosc side if you try it.

@asomers asomers closed this as completed May 24, 2024
@kylebarron
Copy link

In case anyone comes here to try this, there's currently some work to make the C - Rust wasm story a lot simpler: rustwasm/wasm-bindgen#3454

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