use-ink / cargo-contract

Setup and deployment tool for developing Wasm based smart contracts via ink!
GNU General Public License v3.0
249 stars 120 forks source link

Contract build failing for paritytech/ink/examples/rand-extension #911

Closed saki-osive closed 1 year ago

saki-osive commented 1 year ago

I'm trying to build the contracts under paritytech/ink/examples/rand-extension:

I run the command cargo +nightly contract build.

It is failing with the following error:

arcturus@pop-os:~/CLionProjects/ink/examples/rand-extension$ cargo +nightly contract build
2023-01-19T08:51:56.708321Z  INFO cargo_contract::crate_metadata: Fetching cargo metadata for Cargo.toml
ERROR: No 'ink_lang' dependency found

----DEBUG STEPS I TRIED----

If I try to add ink_lang as a dependency(v3.4.0, tried 4.0.0-alpha too) under examples/rand-extension/Cargo.toml and then re-build, I'm getting the error:

   Compiling is-terminal v0.4.2
error: ink! only supports compilation as `std` or `no_std` + `wasm32-unknown`
   --> /home/arcturus/.cargo/registry/src/github.com-1ecc6299db9ec823/ink_allocator-3.4.0/src/bump.rs:107:13
    |
107 | /             compile_error! {
108 | |                 "ink! only supports compilation as `std` or `no_std` + `wasm32-unknown`"
109 | |             }
    | |_____________^

   Compiling env_logger v0.10.0
error[E0599]: no method named `request_pages` found for mutable reference `&mut InnerAlloc` in the current scope
   --> /home/arcturus/.cargo/registry/src/github.com-1ecc6299db9ec823/ink_allocator-3.4.0/src/bump.rs:125:35
    |
125 |             let page_start = self.request_pages(required_pages)?;
    |                                   ^^^^^^^^^^^^^ method not found in `&mut InnerAlloc`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `ink_allocator` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
Error: Compilation failed with toolchain `nightly-2022-06-30-x86_64-unknown-linux-gnu`

Caused by:
    command failed: "cargo" "check" "--target-dir" "/home/arcturus/CLionProjects/ink/examples/rand-extension/target/dylint/target/nightly-2022-06-30-x86_64-unknown-linux-gnu" "--manifest-path" "/home/arcturus/CLionProjects/ink/examples/rand-extension/Cargo.toml"
ERROR: `"/home/arcturus/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo" "dylint" "--lib" "ink_linting" "--manifest-path=/home/arcturus/CLionProjects/ink/examples/rand-extension/Cargo.toml"` failed with exit code: Some(1)

I'm using the latest version of the master branch and the latest version of cargo-contract.

ascjones commented 1 year ago

You need to use the 2.0.0-rc version of cargo-contract with ink!``4.0-beta.

Install with cargo install cargo-contract --version 2.0.0-rc

HCastano commented 1 year ago

@saki-osive I'm going to close this since it should be fixed by Andrew's suggestion