-
Notifications
You must be signed in to change notification settings - Fork 133
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 WebAssembly support #611
Conversation
Fantastic news. Sorry to bother but do you think it can compile https://github.com/MFEK/glif/? That's also a way to test the target. Emscripten has SDL2 native support, why I chose it. |
It seems to use |
Fixed a typo in 70ab149. This is a fixup commit, if this PR is approved, please give me some time to cleanup the branch before merging it 🙏 |
Excellent. I got the example running on both ubuntu and macOS. Some notes:
Should we be concerned or are these just relevant for emscripten < 3.1.1?
@flupke If you'd like to, add yourself to the "Notable Contributions" section in the README.md and also add the webassembly example to the "Examples" section with a link to |
Yes I don't think putting these flags in the rust build script is a good idea, since e.g. ERROR_ON_UNDEFINED_SYMBOLS is a workaround for specific emscripten versions. So I guess we're stuck with these warnings, unfortunately.
Interesting, which browser / version were you using? (someone told me Safari doesn't support WebGL 2, maybe that's related?) @etiennealbert could you run some tests please?
Thanks! done in c618382 |
Latest |
Build is working with emscripten 3.1.1, but requires setting some environment variables: EMCC_CFLAGS="-s ERROR_ON_UNDEFINED_SYMBOLS=0" EMSDK=~/.asdf/installs/emsdk/3.1.1 cargo build --target wasm32-unknown-emscripten ERROR_ON_UNDEFINED_SYMBOLS is a workaround for: warning: ___gxx_personality_v0 may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library This error appeared with emscripten 2.0.10 and has yet to be fixed in rust: rust-lang/rust#85821 (comment) EMSDK is for building skia-bindings against emscripten's platform includes. This is adapted from https://github.com/tuxmark5/rust-skia.
The cargo run option is --features, not --feature
This looks ready. Thank you a lot for your contribution @flupke. I'll add web-assembly CI builds later. Merging. |
What changed
wasm32-unknown-emscripten
targetNote it's the very first time I write Rust code, please don't hesitate to educate me in this review :)
Why?
To fix #39 and because we needed this for https://jitter.video/ (rebuilding our rendering engine in Rust).
How to test
Follow the instructions I added in the top-level README and in
wasm-example/
(not sure this is the right location).