Stream: cargo-component

Topic: component imports instance `wasi:cli/environment@0.2.0`


view this post on Zulip David (Jan 16 2025 at 21:50):

I am using cargo component to generate wasm modules that I run on my wasmtime embedding for plugin purposes. How can I disable cargo-component generating import for wasi-cli/environment@0.2.0 I dont need any of the cli modules of wasi
my Cargo.toml looks like this

[package]
name = "test-plugin"
version = "0.1.0"
edition = "2021"

[dependencies]
wit-bindgen-rt = { version = "0.37.0", features = ["bitflags"] }

[lib]
crate-type = ["cdylib"]

[profile.release]
codegen-units = 1
opt-level = "s"
debug = false
strip = true
lto = true

[package.metadata.component]
package = "rsget:plugin"

[package.metadata.component.target]
path = "../../wit/plugin.wit"

and my wit is like this

package rsget:plugin;

world plugin-provider {
    import print: func(str: string);

    resource config {
      constructor();
      get-name: func() -> string;
    }

    export greet: func(name: string);
}

view this post on Zulip David (Jan 16 2025 at 23:19):

I tried building a module manually using wasm32-unknown-unknown but this it time wasmtime can't parse it so it seems like i have to build targeting wasm32-wasip2

view this post on Zulip David (Jan 16 2025 at 23:31):

#general > wit-bindgen rust host + guest: get-environment has the wrong @ 💬 I found the solution sorry for not searching existing threads more carefully


Last updated: Jan 24 2025 at 00:11 UTC