-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wac plug error: "error: encoding produced a component that failed validation" #141
Comments
Based on this issue: bytecodealliance/wasm-tools#1798
Which results in the following with cargo component build -p salutation The problem resolving this is that we now have a number of different
|
To possibly expand on this from the context of bytecodealliance/wasm-tools#1798 given this input in package a:b;
interface api {
record foo {
x: string,
}
record bar {
x: foo,
}
f1: func() -> bar;
}
interface use-api {
use api.{bar};
f2: func() -> bar;
}
world a {
export api;
}
world b {
export use-api;
} the error can be reproduced with:
the problem being that How best to solve this I'm not sure, it's a bit tricky. One option is to have a first-class error for this situation and just not support it. Another would possible be to synthesize an |
The example you gave above was super helpful in exploring a bit more what is a valid composition, glad to know those tools exist! I spent a little more time with this running thru your example with some future use cases. For me, the workaround of extracting the types into a separate interface is totally workable. If its easy, adding a first class error and a note in the docs would definitely be helpful. After that, given unlimited time and resources I suppose it would be nice to avoid somewhat arbitrarily splitting types and functions into separate interfaces. Thanks so much for your time and attention resolving this issue. 😄 (I'm not sure if you'd like to leave this open for reference or close it out, so I'll leave it up to you) |
I made another types-only component as here, triggering the similar errors as error: encoding produced a component that failed validation
Caused by:
instance not valid to be used as export (at offset 0x19310)
make: *** [Makefile:25: /github.com/sammyne/wasm-component-broken-compose/_out/calculator-composed.wasm] Error 1 Glimpse of WITadder.wit
calculator.wit
Removing the line |
@sammyne maybe you need to remove api-types from the docs-adder |
@alexcrichton , @sammyne 's comment brought up another question for me, would (and how would) the workaround also work if api-types was located in a separate package? |
I believe so yeah, the package part is mostly an organization in WIT as opposed to the component model, so the important bit is having the types in an extra interface rather than which package it's in. |
Repro
https://github.com/estk/hotswap-example
The error
Why this is surprising to me
Since the
user-interface
interface is local to the hotswap::salutation package and the plugged worldtypes
exports theuser-interface
interface, I would have thought that the imports were satisfied and that the underlying types inuser-interface
would be automatically re-exported.WIT at a glance
In the salutation package we have the following:
The text was updated successfully, but these errors were encountered: