Hi all! According to @elcritch in another thread I posted, it should be possible to compile nim to WASM, but I cannot get it done :(
It looks like there is no built-in support for emcc and if I use config nim to use clang and compile nim to C sources, then use emcc to compile these C sources, I'll get a static assert error, saying that the size of "long" is incorrect (can't remember exactly. I'm on another computer without nim). And I tried to "cheat" by setting clang.path and clang.exe to point to emcc.bat, and hoping nim can call emcc directly, but also failed. So... what is the preferred way to compile nim to WebAssembly? I found two other possible solutions: <https://github.com/arnetheduck/nlvm> It claims `wasm32 support is still very bare-bones, so you will need to do a bit of tinkering to get it to work.`. Also I found this: <https://github.com/stisa/nwasm> And I still think It's not a bad idea to compile nim to C sources first, then use emcc just like what I did in my C++ -> WASM projects (I already have several such projects deployed in production). Maybe I just need a few preprocessor defines to satisfy nim's static asserts? BTW: I tried both x64 and x86 versions of nim 1.4.2 (I once suspected wasm32 can only be supported by x86 nim), on windows, but I prefer to use x64 version. BTW2: I need basic WASI support (my WASM programs will be run in server and embedded in C++, not in browser), which is automatically supported by emcc, that's why I prefer to do nim -> c, then use emcc, if possible.
