5 ms·
I've been quite frustrated with the state of WebAssembly. It still feels like a platform that's in beta and not ready for production. Partially this is the slow
by hardwaregeek 4y ago
I've been quite frustrated with the state of WebAssembly. It still feels like a platform that's in beta and not ready for production. Partially this is the slow pace of standardization, partially this is the lack of investment into tooling by various stakeholders.
This plays out precisely as the blog post details with the split between WASI and Web Platform. Say you want to compile a Rust + C codebase to Wasm and run in the browser. You have three targets: wasm32-unknown-emscripten, wasm32-unknown-unknown, and wasm32-wasi. Emscripten is relatively old and not maintained. It'll work but you get some old JS that doesn't play well with newer stuff. wasm32-unknown-unknown has an ABI incompatibility which means you cannot interoperate between C compiled to Wasm and Rust compiled to Wasm. wasm32-wasi works, but now you have to have a WASI implementation in the browser and that's still very immature. Tools like wasm-bindgen or wasm-pack don't work with wasm32-wasi either.
Basically you have the Web Platform backend (wasm32-unknown-unknown) that plays well with the browser part, but does not play well with the interoperability across languages part. And you have the WASI backend (wasm32-wasi) that plays well with the interoperability across languages part but does not play well with browser part.
- Arnavion 4y ago>wasm32-unknown-unknown has an ABI incompatibility which means you cannot interoperate between C compiled to Wasm and Rust compiled to Wasm. Since I was surprised to learn this, and to save everyone else the search, it's https://github.com/rust-lang/rust/issues/71871 https://github.com/rust-lang/rust/issues/71871
- justinclift 4y agoFurther down that GitHub issue, it mentions the problem has been fixed: * https://github.com/rust-lang/rust/issues/71871#issuecomment-757374318 https://github.com/rust-lang/rust/issues/71871#issuecomment-... * https://github.com/rust-lang/rust/pull/79998 https://github.com/rust-lang/rust/pull/79998 Weirdly though, there's another issue (opened prior) that's ongoing and seems to indicate things aren't fixed after all: * https://github.com/rustwasm/team/issues/291 https://github.com/rustwasm/team/issues/291
- Arnavion 4y ago>Further down that GitHub issue, it mentions the problem has been fixed: No, if you look at the diff, it was only fixed for emscripten and wasi.
- trevyn 4y agoNote that this only affects structs that are passed by value, so it’s not always an issue and can be worked around.
- kevingadd 4y agoIt's not your imagination, the 1.0 version of the spec was/is widely referred to as MVP - "Minimum Viable Product" - and it was an ordeal just getting that across the finish line. It's why so many things are missing. The rest of the ecosystem naturally inherited that state of readiness. EDIT: I have to disagree though - emscripten is actively maintained. Not sure why you get the impression otherwise.
- deleted 4y ago[deleted]
- hardwaregeek 4y agoMultiple people in the Rust forum explaining that the wasm32-unknown-emscripten backend is unmaintained and broken: https://users.rust-lang.org/t/emitting-es6-module-for-wasm32-unknown-emscripten/84684/3 https://users.rust-lang.org/t/emitting-es6-module-for-wasm32...
- kevingadd 4y agoWe're using emscripten in production right now. New stuff is committed to its github repository every week and there are new releases. I think you're confusing "wasm32-unknown-emscripten" for "emscripten", the latter is a product you can use to compile software.
- hardwaregeek 4y agoI was talking in the context of Rust backends, in which case emscripten is effectively not maintained. I am aware that emscripten is a product you can use to compile software. Frankly that's a little condescending to phrase it in such a way.
- Matheus28 4y agoEmscripten isn't old. And it's actively maintained...
- hardwaregeek 4y agoPerhaps it is, but the rust backend might not be: https://users.rust-lang.org/t/emitting-es6-module-for-wasm32-unknown-emscripten/84684/3 https://users.rust-lang.org/t/emitting-es6-module-for-wasm32...