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

Fix installation instructions for linter #1540

Closed
cmichi opened this issue Mar 13, 2024 · 1 comment · Fixed by #1546
Closed

Fix installation instructions for linter #1540

cmichi opened this issue Mar 13, 2024 · 1 comment · Fixed by #1546
Assignees
Labels
bug Something isn't working

Comments

@cmichi
Copy link
Collaborator

cmichi commented Mar 13, 2024

When I ran cargo contract build on a fresh machine it gave me this error:

 [==] Checking ink! linting rules
ERROR: Toolchain `nightly-2023-12-28` was not found!
This specific version is required to provide additional source code analysis.


You can install it by executing `rustup install nightly-2023-12-28`.

After executing this command it didn't work:

 [==] Checking ink! linting rules
    Updating git repository `https://github.com/paritytech/ink/`
    Updating git repository `https://github.com/paritytech/ink/`
Error: command failed: cd "/var/folders/s5/5gcp8ck95k39z006fj059_0c0000gn/T/.tmpaq9hjY" && RUSTFLAGS="-C link-args=-Wl,-rpath,/Users/michi/.rustup/toolchains/nightly-2023-12-28-aarch64-apple-darwin/lib" "cargo" "build"
ERROR: command ["/Users/michi/.rustup/toolchains/stable-aarch64-apple-darwin/bin/cargo", "dylint", "--quiet", "--lib=ink_linting_mandatory", "--lib=ink_linting", "--", "--target=wasm32-unknown-unknown", "-Zbuild-std=core,alloc", "--no-default-features"] exited with code 1

I then executed cargo install cargo-dylint dylint-link and got another error:

 [==] Checking ink! linting rules
    Updating git repository `https://github.com/paritytech/ink/`
    Updating git repository `https://github.com/paritytech/ink/`
Checking with toolchain `nightly-2023-12-28-aarch64-apple-darwin`
error: "/Users/michi/.rustup/toolchains/nightly-2023-12-28-aarch64-apple-darwin/lib/rustlib/src/rust/Cargo.lock" does not exist, unable to build with the standard library, try:
        rustup component add rust-src --toolchain nightly-2023-12-28-aarch64-apple-darwin
Error: Compilation failed with toolchain `nightly-2023-12-28-aarch64-apple-darwin`

Caused by:
    command failed: env -u CARGO -u RUSTC CLIPPY_DISABLE_DOCS_LINKS="null" DYLINT_LIBS="[\"/Users/michi/projects/ink/integration-tests/flipper/target/ink/dylint/libraries/nightly-2023-12-28-aarch64-apple-darwin/release/libink_linting@nightly-2023-12-28-aarch64-apple-darwin.dylib\",\"/Users/michi/projects/ink/integration-tests/flipper/target/ink/dylint/libraries/nightly-2023-12-28-aarch64-apple-darwin/release/libink_linting_mandatory@nightly-2023-12-28-aarch64-apple-darwin.dylib\"]" DYLINT_METADATA="{\"libraries\":[{\"git\":\"https://github.com/paritytech/ink/\",\"pattern\":\"linting/mandatory\",\"rev\":\"b6880dd9384e09ec4e7ad65453cd844113e8a316\"},{\"git\":\"https://github.com/paritytech/ink/\",\"pattern\":\"linting/extra\",\"rev\":\"b6880dd9384e09ec4e7ad65453cd844113e8a316\"}]}" DYLINT_NO_DEPS="0" RUSTC_WORKSPACE_WRAPPER="/Users/michi/.dylint_drivers/nightly-2023-12-28-aarch64-apple-darwin/dylint-driver" RUSTUP_TOOLCHAIN="nightly-2023-12-28-aarch64-apple-darwin" "cargo" "check" "--target-dir" "/Users/michi/projects/ink/integration-tests/flipper/target/ink/dylint/target/nightly-2023-12-28-aarch64-apple-darwin" "--target=wasm32-unknown-unknown" "-Zbuild-std=core,alloc" "--no-default-features"
ERROR: command ["/Users/michi/.rustup/toolchains/stable-aarch64-apple-darwin/bin/cargo", "dylint", "--quiet", "--lib=ink_linting_mandatory", "--lib=ink_linting", "--", "--target=wasm32-unknown-unknown", "-Zbuild-std=core,alloc", "--no-default-features"] exited with code 1

After executing rustup component add rust-src --toolchain nightly-2023-12-28-aarch64-apple-darwin it worked.

I saw that the code already checks for cargo-dylint and dylint-link, so not sure why my cargo install changed fix. Maybe because of an updated crate after the install?

Here's what the command did:

Ignored package `dylint-link v2.1.10` is already installed, use --force to override
Replaced package `cargo-dylint v2.5.0` with `cargo-dylint v2.6.1` (executable `cargo-dylint`)

Please

  • add rustup component add rust-src --toolchain nightly-2023-12-28 to the toolchain installation instructions
  • try to find out what the reason for the cargo install cargo-dylint dylint-link thing could be.

Please also check if ink-docs or the readme in cargo-contract need to be adapted.

@cmichi cmichi added the bug Something isn't working label Mar 13, 2024
@cmichi cmichi changed the title Improve installation instructions for linter Fix installation instructions for linter Mar 13, 2024
jubnzv added a commit to jubnzv/cargo-contract that referenced this issue Mar 14, 2024
@jubnzv
Copy link
Member

jubnzv commented Mar 14, 2024

I updated the installation instructions suggested by cargo-contract and README in #1546.

Please also check if ink-docs or the readme in cargo-contract need to be adapted.

I replaced cargo install with rustup run $TOOLCHAIN_VERSION cargo install in the documentation just for the case: use-ink/ink-docs#335

cmichi pushed a commit that referenced this issue Mar 14, 2024
* fix(build): installation instructions for linter

Closes #1540

* fix: Update README

* fix(build): formatting on missing toolchain

Closes #1538

* chore: Update changelog
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

Successfully merging a pull request may close this issue.

2 participants