You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tutorial: invalid crate-type syntax and inconsistent command-component example #376
The Create a command component section has two problems: an invalid Cargo configuration and a mismatch between the library-based instructions and the linked binary example.
1. Invalid crate-type syntax
The tutorial asks readers to create a library with cargo new --lib example and add:
[lib]
crate-type = "cdylib"
Running cargo metadata --no-deps --format-version 1 --offline in that project fails with:
error: invalid type: string "cdylib", expected a sequence
Reproduced with Cargo 1.98.1. The configuration should be:
[lib]
crate-type = ["cdylib"]
2. The completed example uses a different entrypoint approach
The tutorial creates a library crate and asks readers to add export wasi:cli/run@0.2.7 to the app world. However, its linked completed example is a binary:
The app world imports calculate but does not explicitly export wasi:cli/run.
Both approaches are valid, but copying that main() into the tutorial's library project does not implement the requested wasi:cli/run export. Fixing the manifest syntax alone does not resolve this mismatch.
The tutorial and completed example should use the same approach: either keep the cdylib instructions and provide the explicit run implementation and export, or use a binary project built for wasm32-wasip2, where Rust supplies the entrypoint for main().
Hey @ifsheldon thanks for the report, these are definitely issues (!) -- would you be open to making a PR to fix both of these?
I think it might be preferable to show the more "general" way (as a lib, with generated interfaces against any WIT interface), but maybe an admonition (or a full text subsection?) mentioning the other approach (using wasm32-wasip2 directly) is worth putting in.
Activity
vados-cosmonic commentedon Sep 22, 2026
Hey @ifsheldon thanks for the report, these are definitely issues (!) -- would you be open to making a PR to fix both of these?
I think it might be preferable to show the more "general" way (as a lib, with generated interfaces against any WIT interface), but maybe an admonition (or a full text subsection?) mentioning the other approach (using
wasm32-wasip2directly) is worth putting in.