Stream: general

Topic: Tutorial issues in Rust


view this post on Zulip Karl Smit (Mar 19 2024 at 02:26):

Hello, Im trying to go through the examples from the component docs (the calculator example) and Im having some problems.

I can build the module using the given rust and wit files, but cargo component build --release fails to export the add function from adder, so it fails with the following error:

error: failed to validate exported interface `docs:calculator/add@0.1.0`

Caused by:
    module does not export required function `docs:calculator/add@0.1.0#add`

Has wit-bindgen changed the way that things get exported? I needed to add wit-bindgen-rt as a dependency also in order to make it this far.

Thank you

view this post on Zulip Nuke 馃寗 (Mar 19 2024 at 04:35):

I am betting it's you are using a too recent version of cargo component. 0.10.1?

If so, https://github.com/bytecodealliance/component-docs/pull/118 might be what we need.

See https://github.com/bytecodealliance/cargo-component/blob/v0.10.1/example/Cargo.toml#L10-L11 for the present requirements, addresses https://bytecodealliance.zulipchat.com/#narrow/stream/206238-...

view this post on Zulip Jeff Schilling (Mar 21 2024 at 14:23):

Not sure if you resolved this but see the release notes for 0.9.0 (https://github.com/bytecodealliance/cargo-component/releases/tag/v0.9.0) the dependencies did in fact change

Shaun Kerr said:

Hello, Im trying to go through the examples from the component docs (the calculator example) and Im having some problems.

I can build the module using the given rust and wit files, but cargo component build --release fails to export the add function from adder, so it fails with the following error:

error: failed to validate exported interface `docs:calculator/add@0.1.0`

Caused by:
    module does not export required function `docs:calculator/add@0.1.0#add`

Has wit-bindgen changed the way that things get exported? I needed to add wit-bindgen-rt as a dependency also in order to make it this far.

Thank you

鈿狅笍 Breaking Changes 鈿狅笍 There are a few breaking changes in this release that impact existing cargo-component projects. The reintroduction of the export! macro The latest generated bindings has rein...

Last updated: Nov 22 2024 at 17:03 UTC