Stream: wasmtime

Topic: ✔ `canonical_abi` has not been defined


view this post on Zulip Carl Sverre (Sep 23 2021 at 23:17):

I am using the latest version (main) of witx-bindgen and running into the error "canonical_abi" has not been defined. I have a function defined on the host which returns a reference. On the wasm side I am simply echoing the resource back to the host.

Do I need to link something? If I get rid of the resource stuff and just use s32 instead everything works.

view this post on Zulip Carl Sverre (Sep 23 2021 at 23:17):

The witx I am using for the host api is:

resource Row

next: function() -> Row
emit: function(r: Row)

view this post on Zulip Carl Sverre (Sep 23 2021 at 23:17):

the host defines Row as simply a simple struct for now

view this post on Zulip Carl Sverre (Sep 23 2021 at 23:17):

and I am using rust

view this post on Zulip Alex Crichton (Sep 23 2021 at 23:32):

Hm that sounds like a bug in the generated code, can you open an issue for this?

view this post on Zulip Carl Sverre (Sep 23 2021 at 23:33):

sure thing

view this post on Zulip Carl Sverre (Sep 23 2021 at 23:34):

sounds like this PR might be relevant? https://github.com/WebAssembly/interface-types/pull/132

This PR proposes a "canonical ABI" for interface types. This feature was alluded to in Luke's recent presentation to the CG, and this PR intends to flesh it out more and get a more fo...

view this post on Zulip Carl Sverre (Sep 23 2021 at 23:44):

https://github.com/bytecodealliance/witx-bindgen/issues/76

I have a very trivial setup to play with witx types. To reproduce the problem just run cargo run from the root directory. (requires nightly) Use a vscode devcontainer to reproduce my exact environm...

view this post on Zulip Carl Sverre (Sep 24 2021 at 18:04):

@Alex Crichton any ideas on the issue? It's a bit difficult to hack around

view this post on Zulip Alex Crichton (Sep 24 2021 at 18:05):

oops meant to dig in this morning but forgot, let me take a look now

view this post on Zulip Carl Sverre (Sep 24 2021 at 18:05):

thanks!

view this post on Zulip Alex Crichton (Sep 24 2021 at 18:12):

oh so the bad error message is because of wasm_module_linking(true)

view this post on Zulip Alex Crichton (Sep 24 2021 at 18:12):

that's a bug in wasmtime

view this post on Zulip Alex Crichton (Sep 24 2021 at 18:12):

otherwise I see the issue, should be an easy fix on witx-bindgen's part

view this post on Zulip Alex Crichton (Sep 24 2021 at 18:22):

ok should be fixed by <https://github.com/bytecodealliance/witx-bindgen/pull/79>

There was an accidentaly .to_snake_case() when it should have been using the raw name from the witx. Closes #76

view this post on Zulip Alex Crichton (Sep 24 2021 at 18:28):

and I've submitted https://github.com/bytecodealliance/wasmtime/issues/3388 for the bad error message

For this program: use wasmtime::*; fn main() { let mut config = Config::new(); config.wasm_module_linking(true); let engine = Engine::new(&config).unwrap(); let module = Module::new( &engin...

view this post on Zulip Carl Sverre (Sep 24 2021 at 18:58):

woohoo - thanks for the fast turn around. I'll test your PR against my diff

view this post on Zulip Carl Sverre (Sep 24 2021 at 22:19):

works great - thanks for the quick turnaround

view this post on Zulip Notification Bot (Sep 24 2021 at 22:19):

Carl Sverre has marked this topic as resolved.


Last updated: Oct 23 2024 at 20:03 UTC