Stream: wasi

Topic: bundling shared-everything libraries


view this post on Zulip Dan Gohman (Apr 10 2025 at 13:40):

What's the current state of bundling shared-everything "dynamic" libraries in wasi-sdk and wasm-tools?

view this post on Zulip Joel Dice (Apr 10 2025 at 13:51):

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.

Repository for design and specification of the Component Model - WebAssembly/component-model

view this post on Zulip Dan Gohman (Apr 10 2025 at 13:53):

What's the best way to link an executable with undefined symbols that will be defined in a dynamic library?

view this post on Zulip Dan Gohman (Apr 10 2025 at 13:55):

I know about -Wl,--warn-unresolved-symbols, but I'm curious if there's a better way.

view this post on Zulip Joel Dice (Apr 10 2025 at 14:00):

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.

view this post on Zulip Victor Adossi (Apr 23 2025 at 14:07):

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?)

view this post on Zulip Joel Dice (Apr 23 2025 at 14:50):

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.

Contribute to bytecodealliance/componentize-py development by creating an account on GitHub.
Contribute to bytecodealliance/componentize-py development by creating an account on GitHub.

view this post on Zulip Victor Adossi (Apr 23 2025 at 16:17):

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