anchor: Failed to install 0.30.1, is it a valid version

I want to install anchor-cli,but it is fail,

  • Error info(It only has important information):
root@WIN-73FSLR1FGIE:/mnt/c/Users/Administrator# avm install latest
    Updating git repository `https://github.com/coral-xyz/anchor`
warning: skipping duplicate package `relations-derivation` found at `/root/.cargo/git/checkouts/anchor-50c4b9c8b5e0501f/e6d7daf/tests/idl/programs/relations-derivation`
warning: skipping duplicate package `external` found at `/root/.cargo/git/checkouts/anchor-50c4b9c8b5e0501f/e6d7daf/tests/declare-program/programs/external`
warning: skipping duplicate package `shared` found at `/root/.cargo/git/checkouts/anchor-50c4b9c8b5e0501f/e6d7daf/tests/typescript/programs/shared`
warning: skipping duplicate package `shared` found at `/root/.cargo/git/checkouts/anchor-50c4b9c8b5e0501f/e6d7daf/tests/zero-copy/programs/shared`
warning: skipping duplicate package `docs` found at `/root/.cargo/git/checkouts/anchor-50c4b9c8b5e0501f/e6d7daf/tests/docs/programs/docs`
warning: skipping duplicate package `swap` found at `/root/.cargo/git/checkouts/anchor-50c4b9c8b5e0501f/e6d7daf/tests/swap/programs/swap`
  Installing anchor-cli v0.30.1 (https://github.com/coral-xyz/anchor?tag=v0.30.1#e6d7dafe)
    Updating crates.io index
warning: package `ahash v0.7.6` in Cargo.lock is yanked in registry `crates-io`, consider running without --locked
warning: package `spl-pod v0.1.1` in Cargo.lock is yanked in registry `crates-io`, consider running without --locked
error[E0282]: type annotations needed for `Box<_>`
  --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/time-0.3.29/src/format_description/parse/mod.rs:83:9
   |
83 |     let items = format_items
   |         ^^^^^
...
86 |     Ok(items.into())
   |              ---- type must be known at this point
   |
help: consider giving `items` an explicit type, where the placeholders `_` are specified
   |
83 |     let items: Box<_> = format_items
   |              ++++++++

   Compiling bs58 v0.5.0
   Compiling async-trait v0.1.79
   Compiling minimal-lexical v0.2.1
   Compiling base64 v0.13.1
   Compiling rustix v0.38.15
   Compiling anchor-syn v0.30.1 (/root/.cargo/git/checkouts/anchor-50c4b9c8b5e0501f/e6d7daf/lang/syn)
For more information about this error, try `rustc --explain E0282`.
error: could not compile `time` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `anchor-cli v0.30.1 (https://github.com/coral-xyz/anchor?tag=v0.30.1#e6d7dafe)`, intermediate artifacts can be found at `/tmp/cargo-installLPxsv0`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
Error: Failed to install 0.30.1, is it a valid version?
  • I can compile successful
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y pkg-config build-essential libudev-dev libssl-dev
  • this command is also an error info
cargo install --git https://github.com/coral-xyz/anchor --tag v0.30.1 anchor-cli --locked
  • I tried to fix it, but I failed
root@WIN-73FSLR1FGIE:/mnt/c/Users/Administrator# cargo update -p time
error: could not find `Cargo.toml` in `/mnt/c/Users/Administrator` or any parent directory

but cargo new project is successful
  • my system:
  System:
    OS: Windows 11 10.0.22631
    CPU: (16) x64 AMD Ryzen 7 5800H with Radeon Graphics
    Memory: 3.69 GB / 15.86 GB

WSL 2 of windows: Ubuntu-22.04

root@WIN-73FSLR1FGIE:/mnt/c/Users/Administrator# yarn --version
1.22.22
root@WIN-73FSLR1FGIE:/mnt/c/Users/Administrator# solana --version
solana-cli 1.18.18 (src:83047136; feat:4215500110, client:SolanaLabs)
root@WIN-73FSLR1FGIE:/mnt/c/Users/Administrator# rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: checking for self-update

  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.80.0 (051478957 2024-07-21)

info: cleaning up downloads & tmp directories

and windows has installed anchor, but it has a bug.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 15

Commits related to this issue

Most upvoted comments

It looks like rustc 1.80 broke one of our dependencies (https://github.com/time-rs/time/issues/693).

The easiest fix would be to install without the --locked option to get the patched version of the time crate:

cargo install --git https://github.com/coral-xyz/anchor --tag v0.30.1 anchor-cli

Or use rustc <1.80 to install.

+1 macOS 😦

It looks like rustc 1.80 broke one of our dependencies (time-rs/time#693).

The easiest fix would be to install without the --locked option to get the patched version of the time crate:

cargo install --git https://github.com/coral-xyz/anchor --tag v0.30.1 anchor-cli

Or use rustc <1.80 to install.

The following steps worked for me:

# install rustc < 1.80
rustup install 1.79

# set default version
rustup default 1.79-aarch64-apple-darwin # (MacOS)

# proceed with normal install...

It looks like rustc 1.80 broke one of our dependencies (time-rs/time#693). The easiest fix would be to install without the --locked option to get the patched version of the time crate:

cargo install --git https://github.com/coral-xyz/anchor --tag v0.30.1 anchor-cli

Or use rustc <1.80 to install.

The following steps worked for me:

# install rustc < 1.80
rustup install 1.79

# set default version
rustup default 1.79-aarch64-apple-darwin # (MacOS)

# proceed with normal install...

it worked for me,tks