What's the current state of bundling shared-everything "dynamic" libraries in wasi-sdk and wasm-tools?
Bundling them into components, you mean? It should be as simple as passing -shared to clang when linking to produce a .so and using wasm-tools component link to bundle it (and any other .so files it might depend on, e.g. libc.so) into a component.
See https://github.com/WebAssembly/component-model/blob/main/design/mvp/Linking.md for an overview. I'm happy to answer any questions about the details.
What's the best way to link an executable with undefined symbols that will be defined in a dynamic library?
I know about -Wl,--warn-unresolved-symbols, but I'm curious if there's a better way.
I haven't tried that myself, so I don't know. And wasm-tools component link currently assumes all the input files are .so files and that it is responsible for synthesizing a "main" module (i.e. the one that exports a memory and table), so it will need some work to accommodate a user-supplied main module.
Hey Joel is there a reasonable guide/example repo for this?
It's a pretty advanced thing to try and do but maybe someone ought to write up an example project that does this. I might try and take a stab at this for a common case (Python? C?)
wasm-tools component link --help is a good place to start. I don't know of a complete, up-to-date, simple example project which illustrates all the steps, though.
You can find examples of building .so files using the -shared flag to clang in componentize-py's build.rs, and an example of using wit-component to compose them into a component programmatically here.
Thanks -- left myself a component-docs issue -- that's where I'm going to try and land this (possibly pointing to an example repo)
Last updated: Dec 06 2025 at 06:05 UTC