fermyon / spin-trigger-cron

Apache License 2.0
7 stars 8 forks source link

Getting this `error: linking with `rust-lld` failed: exit status: 1` #7

Closed seungjin closed 8 months ago

seungjin commented 8 months ago

Almost identical to sample source

#[cron_component]
fn foo(metadata: Metadata) -> Result<(), Error> {
    println!("[{}] Hello from a cron component", metadata.timestamp);
    Ok(())
}

But getting error: linking withrust-lldfailed: exit status: 1

Error:

error: linking with `rust-lld` failed: exit status: 1
  |
....
...
...
  = note: rust-lld: error: duplicate symbol: cabi_realloc
          >>> defined in /var/home/seungjin/Works/wasm/random-cafe/target/wasm32-wasi/release/deps/libwit_bindgen-1f99a85c6fa2b806.rlib(wit_bindgen-1f99a85c6fa2b806.wit_bindgen.683f3aae886dbaf2-cgu.0.rcgu.o)
          >>> defined in /var/home/seungjin/Works/wasm/random-cafe/target/wasm32-wasi/release/deps/libwit_bindgen-69eae4c2eee7f15c.rlib(wit_bindgen-69eae4c2eee7f15c.wit_bindgen.7d16c78f0b1f41d9-cgu.0.rcgu.o)
seungjin commented 8 months ago

Found why:

[dependencies]
anyhow = "1"
#spin-sdk = { path = "../../rust/spin-rust-sdk" }
spin-sdk = { git = "https://github.com/fermyon/spin", tag = "v2.0.1" }
spin-cron-sdk = { path = "../../rust/spin-trigger-cron/sdk" }

Above ^ works. https://github.com/fermyon/spin-trigger-cron/blob/3f10944fb7c47d21d765e6ff584f9404dce86dda/Cargo.toml#L23

seungjin commented 8 months ago

I can see why my app with most recent sdk was not working. Please someone close this if it is ok.

seungjin commented 8 months ago

FYI. Context here: https://discord.com/channels/926888690310053918/1219179630972502090