Skip to content
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

Versions of wit-bindgen don't match #327

Open
jsturtevant opened this issue Aug 6, 2024 · 1 comment
Open

Versions of wit-bindgen don't match #327

jsturtevant opened this issue Aug 6, 2024 · 1 comment

Comments

@jsturtevant
Copy link

The version in the project and the version the binding create are off:

cargo component --version
cargo-component-component 0.15.0

cargo component new --lib test-version
cd test-version

cat Cargo.toml
[package]
name = "test-version"
version = "0.1.0"
edition = "2021"

[dependencies]
wit-bindgen-rt = { version = "0.29.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 = "component:test-version"

[package.metadata.component.dependencies]
cargo component build 

 head src/bindings.rs
// Generated by `wit-bindgen` 0.25.0. DO NOT EDIT!
// Options used:
#[doc(hidden)]
#[allow(non_snake_case)]
pub unsafe fn _export_hello_world_cabi<T: Guest>() -> *mut u8 {
    #[cfg(target_arch = "wasm32")]
    _rt::run_ctors_once();
    let result0 = T::hello_world();
    let ptr1 = _RET_AREA.0.as_mut_ptr().cast::<u8>();
    let vec2 = (result0.into_bytes()).into_boxed_slice();

Notice the versions are not the same (wit-bindgen-rt = { version = "0.29.0", and // Generated by wit-bindgen 0.25.0. DO NOT EDIT!

This doesn't seem to cause a problem with current versions, but I think it could?

@primoly
Copy link
Contributor

primoly commented Aug 7, 2024

The new command invokes cargo add --quiet wit-bindgen-rt --features bitflags1, causing cargo to look for the newest version of that crate (currently 0.29.0), but cargo component itself still uses 0.25.0 of wit-bindgen-rust and wit-bindgen-core2.

Footnotes

  1. https://github.com/bytecodealliance/cargo-component/blob/f16644d24cce4f2a5cbab4a14f9f1801c4c76ec5/src/commands/new.rs#L315-L321

  2. https://github.com/bytecodealliance/cargo-component/blob/f16644d24cce4f2a5cbab4a14f9f1801c4c76ec5/Cargo.toml#L103-L104

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants