Stream: wasmtime

Topic: cyclic dependency question


view this post on Zulip Ludvig Liljenberg (Sep 18 2024 at 21:26):

Hi I am new to wasmtime and I am right now trying to implement https://github.com/bytecodealliance/wasmtime/issues/8784.

I am trying to access both wasmtime_cache and wasmt_time_cli_flags at the same time, but no matter what I try, I get a cyclic dependency. For example if I make a new crate wastime-config-loader, which depends on those 2, and try to use it from wasmtime, I get

 cargo check
error: cyclic package dependency: package `wasmtime v26.0.0 (/home/azureuser/wasmtime/crates/wasmtime)` depends on itself. Cycle:
package `wasmtime v26.0.0 (/home/azureuser/wasmtime/crates/wasmtime)`
    ... which satisfies path dependency `wasmtime` (locked to 26.0.0) of package `wasmtime-cli-flags v26.0.0 (/home/azureuser/wasmtime/crates/cli-flags)`
    ... which satisfies path dependency `wasmtime-cli-flags` (locked to 26.0.0) of package `wasmtime-config-loader v26.0.0 (/home/azureuser/wasmtime/crates/config-loader)`
    ... which satisfies path dependency `wasmtime-config-loader` (locked to 26.0.0) of package `wasmtime v26.0.0 (/home/azureuser/wasmtime/crates/wasmtime)`
    ... which satisfies path dependency `wasmtime` (locked to 26.0.0) of package `component-test-util v0.0.0 (/home/azureuser/wasmtime/crates/misc/component-test-util)`

The reason I try to access these 2 crates are because wasmtime-cache knows how to deserialize cache options, and I added serde_derive::Deserialize to OptimizeOptions, CodegenOptions, DebugOptions, etc inside wasmtime-cli-flags. Using these crates would allow me to keep the toml settings in sync with the cli settings. How could I solve this?

Feature Wasmtime offers flexible configurability through options like the "pooling allocation strategy" and "parallel compilation", which can be set programmatically using the wasmtime::Config stru...

view this post on Zulip Alex Crichton (Sep 19 2024 at 15:36):

Hello! I'll caution you in that issue may not be the best issue to take on for a newcomer to Wasmtime and/or Rust. It'll probably require some nontrivial design/planning work to get it integrated in a way that doesn't duplicate lots of bits and pieces across the codebase.

Currently I think we mostly think that the high-level idea is great but we don't have a great idea about how specifically to solve it. In that sense I at least don't have a great answer to your question on-hand.

view this post on Zulip Ludvig Liljenberg (Sep 27 2024 at 16:24):

Thank you very much for the reply ! If I wanted to discuss some options for designing this, how would I best go about this?

view this post on Zulip Alex Crichton (Sep 28 2024 at 12:22):

Would you be up for a zoom/online call next week perhaps?

view this post on Zulip Ludvig Liljenberg (Sep 29 2024 at 04:52):

yes that would be great!

view this post on Zulip Mossaka (Joe) (Oct 01 2024 at 17:09):

I think issue #8784 specially is a feature request to support a configuration file for wasmtime Config, such that both wasmtime CLI and SKD can construct a Config from a configuration file.

I hear that you want to make sure there is a single source of truth for configuration, which is not the case at the moment. That would be a nice follow up and refactoring work.


Last updated: Dec 23 2024 at 14:03 UTC