Hello all, I am new to Wasm and Cranelift and wanted to play with it with C++ code. I am trying to compile the C++ code to wasm and also to cranelift IR. I read few documents and saw that C++ exception handling and threads in Wasm are still in development/proposal phase. Given that would it be right to think about replacing the JVM jit environment with wasm at the moment ? Also any concrete starting points in that direction would be really appreciated. TIA.
Exception handling and threads for WebAssembly are both stage 2 proposals right now. Follow the links on that page for more info.
Whether or not wasm is a suitable replacement for the JVM depends greatly on how you want to use it. If you need exception handling and threads, then it's not all the way there yet.
Hi Dan, thanks a lot for your comments. Any other starting points for C++ to wasm ?
Are you interested in wasm in browsers, outside of browsers, or both?
outside of browsers
wasi-sdk has packages of clang for C/C++ configured to work with wasi-libc and builds of libc++
https://github.com/WebAssembly/wasi-sdk
Dan, is that also available for arm64-linux? It would be useful (for current dev work) if it was. Currently we have to compile C++ to wasm on an x86 box and then scp it to an arm64 box for testing, which is, well, something that would be nice to be able to avoid.
Unfortunately no, we don't have precompiled packages for arm64 yet.
If you build it from source, it ought to work though.
and rust/cargo should work
@Joey Gouly sure, but I really would prefer to start with C test cases.
@Dan Gohman do you happen to know if building from source is a complex process (mucho hoop jumping?) Or is it something nice like ./configure ; make ; make install?
It's a pretty simple process in theory: check out wasi-sdk, init the git submodules, run "make", you now have /opt/wask-sdk/bin/clang etc. and are good to go
Set PREFIX=...
on the make invocation if you want it to build somewhere else.
@Dan Gohman thanks! I'll give it a try.
Last updated: Nov 26 2024 at 00:12 UTC