From to the component model book
You can also use your installed system or Emscripten
clangby building with--target=wasm32-wasi, but you will need some artifacts from WASI SDK to enable and link that build target (see the text aboutlibclang_rt.*.aobjects in the WASI SDK README).
I don't think that this is actually true for p2. But if it is, can anyone give me any pointers on how to do this?
I'm trying to get a large project (onnx runtime) to compile to p2. It already has support for web via Emscripten, and I'm really struggling trying to add wasi-sdk as a new toolchain, so if I can somehow use Emscripten that would help a lot.
you're right that Emscripten only supports wasip1, yes. Unfortunately even with that, it doesn't help make use of any Emscripten specific web support for a p2 target: the APIs and ABI are very different at that point, so I don't think you'll be able to get around the need for source changes
Thanks!
We gotta update the docs then
agreed, yes. Mind filing an issue (or opening a PR)?
https://github.com/bytecodealliance/component-docs/pull/320
Thanks for making the PR @Mendy Berger ! it's merged in now.
While I considered a bit about whether we should leave the hint that p1 support is available in there, it's probably worth just taking out to avoid misleading people
:thumbs_up:
I spent a lot of time trying to get it to work before realizing that it's not really true, so I agree with removing it
Last updated: Dec 06 2025 at 05:03 UTC