Skip to content

Conversation

@tschneidereit
Copy link
Contributor

The Rust examples were all using Spin SDK 2.2.0, which targets a release candidate of WASIp2, not the final version. That means they only ran in Spin, not other WASI runtimes such as Wasmtime.

This commit updates all applicable examples to the latest Spin SDK and changes the build target to wasm32-wasip2 to directly build components.

Fixes #3275

The Rust examples were all using Spin SDK 2.2.0, which targets a release candidate of WASIp2, not the final version. That means they only ran in Spin, not other WASI runtimes such as Wasmtime.

This commit updates all applicable examples to the latest Spin SDK and changes the build target to `wasm32-wasip2` to directly build components.

Signed-off-by: Till Schneidereit <[email protected]>
@fibonacci1729
Copy link
Collaborator

Closing #3258 in favor of this one.

Also, would you mind updating gh workflows (build.yml and release.yml) to use the wasm32-wasip2 target?

Copy link
Collaborator

@fibonacci1729 fibonacci1729 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the gh workflows are updated and the comment about missing export! is addressed the tests should pass and this looks good to me!

Signed-off-by: Till Schneidereit <[email protected]>
@ThorstenHans
Copy link
Contributor

This is great!

With the samples compiling to wasm32-wasip2, I guess we would also want to update all the templates and spin doctor?

If so, I'm happy to help - especially with the templates. For spin doctor I see two ways of addressing this:

  • we could flag manifests that have wasm32-wasip1 as target for Rust components and check if the wasm32-wasip2 target is installed
  • we could report a suggestion and ask users to manually update the target in their build instructions and keep on checking for both Rust targets installed (maybe we're hitting cases where auto-upgrading from p1 to p2 could result in errors)

Signed-off-by: Till Schneidereit <[email protected]>
@tschneidereit
Copy link
Contributor Author

I guess we would also want to update all the templates and spin doctor?

I think updating the templates makes sense, yes. Brian's #3258 (which I had missed—apologies!) did that, though I think there were a few more parts of the templates that need updating.

I'm less sure about spin doctor: there's not necessarily anything really wrong with targeting wasip1, and for now that's the only way to use Wizer. (That latter part will soon change, though.)

@itowlson itowlson merged commit d3d0903 into spinframework:main Sep 18, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Understanding the differences between Spin and Wasmtime in wasip2 imports resolution

5 participants