Hello I’m trying to use emscripten with Rust, through the wasm32-unknown-emscripten target, ultimately to a port a large application (why not wasm32-unknown-unknown instead? I might try that next, but would like use Emscripten for the reasons in this post: Wasm unknown vs emscripten)
So I reached the point where I’m able to compile with
--target wasm32-unknown-emscripten, progress… but the application crashes immediately. I tracked it down to the winit dependency, used by the glutin SDL wrapper. The problem isn’t anything specific with my app, it even reproduces with the winit “hello world” example (window)! Filed this issue to winit:
https://github.com/tomaka/winit/issues/760 missing function: emscripten_set_mousemove_callback
There is also a closed issue on the Emscripten issue tracker with some insights, same error message, but apparently a different cause: https://github.com/emscripten-core/emscripten/issues/7525. Note that I reproduced the issue on a fresh reinstall, so there are not any stale caches etc. causing the issue.
The Emscripten developers raised the question, maybe the Rust compiler stores precompiled libraries which are outdated and need to rebuilt? I updated to Rust stable 1.32, and it installed
info: installing component 'rust-std' for 'wasm32-unknown-emscripten', is it possible these are compiled with an outdated Emscripten SDK?
Ultimately my question is: what is a simple known-working configuration for using Emscripten with Rust? If I can setup a trivial example working program, I can backtrack and isolate what is causing the issues here.
rustup target install wasm32-unknown-emscripten cargo build --example window --target wasm32-unknown-emscripten
This rules out using glutin, at least with this emsdk. What crates and versions are people using Rust with Emscripten actually using? Older versions of emsdk? Other compatible crates? Is this even a winit problem or emscripten problem or rust-std problem? What actually works? Any help appreciated.