conda-forge / conda-forge/conda-forge.github.io
WASM as a supported architecture
- Dominant language
- JavaScript
- Stars
- 170
- Forks
- 320
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 5
Description
I am opening an issue to track the state of `wasm` as a supported architecture. There have been a few discussions here and there about "what it would mean if conda-forge would support wasm" as a platform.
It would be cool if conda-forge had compiler activation scripts to cross-compile from linux-64 or other common architectures to `wasm-32` (or should it be `linux-wasm32`?). The `clang` compiler can already do that.
Furthermore, we probably need a "standard libc" library. I think [`wasi-libc`](https://github.com/WebAssembly/wasi-libc) is such a candidate. Locally I have a recipe, it's really easy to compile.
The way I understand how stuff works is that we would add a new architecture and a "cross-compiler", so that e.g. build will be `linux-64` and host will be `wasm-32`. Then the `{{ compiler('c') }}` will resolve to `_wasm-32` where compiler name will be either some default or chosen from the `conda_build_config.yaml`. In our case it should probably be `clang`. That compiler package would have a dependency on the real clang and a dependency (or contain) activation scripts for setting up CMake and autogen variables to do cross-compilation (those activation scripts would probably be derived from [ctng-compiler-activation-feedstock](https://github.com/conda-forge/ctng-compiler-activation-feedstock), right? The compiler would also push a libc dependency into the host and run envs.
Once we have some successful cross-compiled packages, we can run them using tools like `wasmer` (or in the browser). However, `wasmer` would need to be installed with the host-architecture, so it's currently unclear how we would use this, ideally (stacking envs? one with linux-64, one with wasm-32?). But this discussion can be deferred right now.
There is also the alternative of using `emscripten`. As far as I understand, emscripten comes with some magic: a libc implementation, and it uses compiler-wrappers (as well as cmake and autotools wrappers). It will also generate some javascript entrypoints that make binaries runnable directly under node IIRC. However, I think that for conda-forge the "pure cross-compilation" with clang would be more desirable.
Any input / comments are appreciated! Would be cool to get something going :)
cc @bollwyvl @isuruf @SylvainCorlay @rth
Contributor guide
Assessment
This issue has not been assessed yet.