Skip to content

Error Failed to run app, Failed to read module #332

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

Open
2xic opened this issue Apr 23, 2025 · 1 comment
Open

Error Failed to run app, Failed to read module #332

2xic opened this issue Apr 23, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@2xic
Copy link

2xic commented Apr 23, 2025

Which library is the bug in?

No response

Which version of are you on?

0.1.7

Operating System

macOS (Apple Silicon)

Describe the bug

Hey, this seemed like a really cool project and I wanted to give it a try!

I followed the guide here for creating my my-awesome-contract, but sadly whenever I try to build I see the following

brage@brages-MacBook-Pro my-awesome-contract % elko build
    Finished `release` profile [optimized] target(s) in 0.02s
Error: 
   0: Failed to run app, Failed to read module

Location:
   /Users/brage/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zinkup-0.1.7/src/lib.rs:40

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

I also tried to clone the repo and build + run it locally, but that also didn't work

brage@brages-MacBook-Pro zink % RUST_BACKTRACE=full cargo run --bin elko build /Users/brage/my-awesome-contract
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.11s
     Running `target/debug/elko build /Users/brage/my-awesome-contract`
    Finished `release` profile [optimized] target(s) in 0.01s
Error: 
   0: Failed to run app, Failed to read module

Location:
   /Users/brage/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ccli-0.0.1/src/lib.rs:30

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 11 frames hidden ⋮                              
  12: ccli::App::start::{{closure}}::hc574a9cf9565ce8f
      at /Users/brage/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ccli-0.0.1/src/lib.rs:30
        28 │ 
        29 │         tracing_subscriber::fmt().with_env_filter(env).init();
        30 >         app.run().map_err(|e| eyre!("Failed to run app, {e}"))?;
        31 │         Ok(())
        32 │     }
  13: core::result::Result<T,E>::map_err::h5e5da676acfdd5f1
      at /Users/brage/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/result.rs:856
       854 │         match self {
       855 │             Ok(t) => Ok(t),
       856 >             Err(e) => Err(op(e)),
       857 │         }
       858 │     }
  14: ccli::App::start::h519b78d4124d655e
      at /Users/brage/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ccli-0.0.1/src/lib.rs:30
        28 │ 
        29 │         tracing_subscriber::fmt().with_env_filter(env).init();
        30 >         app.run().map_err(|e| eyre!("Failed to run app, {e}"))?;
        31 │         Ok(())
        32 │     }
  15: elko::main::h8842f85df28fdcd7
      at /Users/brage/Desktop/zink/zink/elko/src/bin/elko.rs:45
        43 │ /// The main function.
        44 │ fn main() -> Result<()> {
        45 >     Elko::start()
        46 │ }
  16: core::ops::function::FnOnce::call_once::hf902aa16b960b7f6
      at /Users/brage/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250
       248 │     /// Performs the call operation.
       249 │     #[unstable(feature = "fn_traits", issue = "29625")]
       250 >     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
       251 │ }
       252 │ 
  17: std::sys::backtrace::__rust_begin_short_backtrace::h46f513908b1553ca
      at /Users/brage/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs:152
       150 │     F: FnOnce() -> T,
       151 │ {
       152 >     let result = f();
       153 │ 
       154 │     // prevent this frame from being tail-call optimised away
                                ⋮ 12 frames hidden ⋮                              

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.

I also tried to just do the steps as mentioned on the How it works to see if I workaround it, but zinkc didn't output any file in my case.

Any tips / ideas for how to fix this ? 🤔

logs

Please include the logs as well if relevant.


@2xic 2xic added the bug Something isn't working label Apr 23, 2025
@2xic
Copy link
Author

2xic commented Apr 23, 2025

Actually, never mind looks like doing it manually did work, but it didn't create it in the same directory as I expected.

cargo b --target wasm32-unknown-unknown --release
cp ./target/wasm32-unknown-unknown/release/my_awesome_contract.wasm target/zink/my-awesome-project.wasm
zinkc target/zink/my-awesome-project.wasm

I expected the file to be in my current working directory (where gcc would have put it), but it was in target/zink/.

brage@brages-MacBook-Pro my-awesome-contract % xxd -p target/zink/my-awesome-project
6020356000350160005260206000f3

Edit: But then I wanted to compile the ERC20 example and that failed also when trying to compile it manually 🤔

On d65354b7783d99ed36478373adb362fa8cbdd1f7

brage@Mac zink % cargo run --bin zinkc -- /Users/brage/my-awesome-contract/target/zink/my-awesome-project.wasm    

    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.09s
     Running `target/debug/zinkc /Users/brage/my-awesome-contract/target/zink/my-awesome-project.wasm`
Error: 
   0: Failed to run app, Host function asm::revert1 not found in compiler

Location:
   /Users/brage/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ccli-0.0.1/src/lib.rs:30

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.

Latest tool-chain (zinkc --version gives zinkc 0.1.7)

brage@brages-MacBook-Pro my-awesome-contract % zinkc target/zink/my-awesome-project.wasm
Error: 
   0: Failed to run app, Unsupported host function EmitABI

Location:
   /Users/brage/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zinkup-0.1.7/src/lib.rs:40

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Where /Users/brage/my-awesome-contract/target/zink/my-awesome-project.wasm is compiled from this file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant