entropyxyz / programs

Source, toolchain, and examples for using programs on Entropy
https://docs.entropy.xyz/concepts/programs/
GNU Affero General Public License v3.0
19 stars 3 forks source link

README example requires `cargo-component 0.2.0`. #85

Closed johnnymatthews closed 2 months ago

johnnymatthews commented 2 months ago

Ran into the following error when trying to build the Basic length-check program found in this project's README on the master branch:

> cargo component build --release -p template-barebones --target wasm32-unknown-unknown

info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2024-06-13, rust version 1.79.0 (129f3b996 2024-06-10)
info: component 'clippy' for target 'x86_64-unknown-linux-gnu' is up to date
info: component 'rustfmt' for target 'x86_64-unknown-linux-gnu' is up to date
info: downloading component 'rust-std' for 'wasm32-unknown-unknown'
info: installing component 'rust-std' for 'wasm32-unknown-unknown'
error: failed to create a target world for package `template-barebones` (/home/io/Code/entropy/programs/examples/barebones/Cargo.toml)

Caused by:
    0: failed to parse local target from directory `/home/io/Code/entropy/programs/examples/barebones/../../wit`
    1: expected ';', found keyword `world`
            --> /home/io/Code/entropy/programs/examples/barebones/../../wit/application.wit:3:1
             |
           3 | world program {
             | ^

I've verified I've got all the pre-requisites listed at the start of the README:

> rustc --version && cargo-component --version && cargo-generate --version && wasm-tools --version

rustc 1.79.0 (129f3b996 2024-06-10)
cargo-component 0.13.2 (wasi:040ec92)
cargo generate 0.21.1
wasm-tools 1.211.1
JesseAbram commented 2 months ago

mmm I just ran it and it worked, what branch you on? also is the branch up to date, also I mean did you accidentally edit the wit file?

rustc 1.77.2 (25ef9e3d8 2024-04-09)
cargo-component 0.2.0 (wasi:aec4b25)
cargo generate 0.20.0
wasm-tools 1.0.54

wow Im hella older versions then you

johnnymatthews commented 2 months ago

[...] README on the master branch:

Nah, not edited anything else. Literally just cloned the repo, installed the deps, and ran the cargo component build --release -p template-barebones --target wasm32-unknown-unknown command. Feels like I'm missing some other deps, or I need a specific version of something.

JesseAbram commented 2 months ago

hmmm wanna downgrade your cargo component version, an updated wit parser can have error similar to this https://github.com/bytecodealliance/wasmtime/issues/5833

johnnymatthews commented 2 months ago

Alright nice, downgrading to cargo-component 0.2.0 did the trick. I'll make a PR to update the README.

JesseAbram commented 2 months ago

much love good find