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

Failed to install 0.30.1, is it a valid version #3126

Closed
congmucc opened this issue Jul 27, 2024 · 14 comments
Closed

Failed to install 0.30.1, is it a valid version #3126

congmucc opened this issue Jul 27, 2024 · 14 comments
Labels
avm installation error Issues related to installation errors

Comments

@congmucc
Copy link

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.

@gimwu
Copy link

gimwu commented Jul 27, 2024

Same to me, and my system is linux

@koko57
Copy link

koko57 commented Jul 27, 2024

+1 macOS :(

@acheroncrypto acheroncrypto added the installation error Issues related to installation errors label Jul 27, 2024
@acheroncrypto
Copy link
Collaborator

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.

@DashBarkHuss
Copy link

+1 macOS

@thaihau
Copy link

thaihau commented Jul 28, 2024

+1 macOS.

@congmucc
Copy link
Author

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.

it's cool, I ran it successfully in VScode wsl terminal, but there are some minor bugs.

warning: unexpected `cfg` condition name: `nightly`
 --> cli/src/lib.rs:1:13
  |
1 | #![cfg_attr(nightly, feature(proc_macro_span))]
  |             ^^^^^^^
  |
  = help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows`
  = help: consider using a Cargo feature instead
  = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
           [lints.rust]
           unexpected_cfgs = { level = "warn", check-cfg = ['cfg(nightly)'] }
  = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(nightly)");` to the top of the `build.rs`
  = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
  = note: `#[warn(unexpected_cfgs)]` on by default

warning: `anchor-cli` (lib) generated 1 warning

bug It ran successfully. but the last time I ran 'unlock' on the wsl that was opened in the windows terminal failed, Maybe this time it ran in vs? and I updated the gcc at the same time,it's weird.

@krusher55
Copy link

krusher55 commented Aug 1, 2024

found a solution, i just mentioned it here #3131 (comment)

@zarifpour
Copy link

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...

@RandyWangR
Copy link

I had the same issue and fixed by replace my rustc version to a lower one. But a new problem came out is
`C:\Users\23793>avm use latest
Version 0.30.1 is not installed, no current version.
Error: You need to run 'avm install 0.30.1' to install it before using it.

C:\Users\23793>avm --version
avm 0.30.1

C:\Users\23793>anchor --version
anchor-cli 0.30.1

C:\Users\23793>anchor init day1
Error: program not found`
please sb help

@szxyidao
Copy link

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

@VGabriel45
Copy link

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...

Worked for me as well.

@jilt
Copy link

jilt commented Sep 10, 2024

  • Windows 11 (fixed by removing the --locked flag)
  • Debian Linux wsl (had to downgrade rustc)

@a-zmuth
Copy link

a-zmuth commented Sep 29, 2024

Go to the directory where the error is coming from

"C:\Users\username.cargo\registry\src\index.crates.io-6f17d22bba15001f\time-0.3.29\src\format_description\parse\mod.rs:83:9"

Edit the parse_owned function on line 75-88 in the mod.rs file with this:

    pub fn parse_owned<const VERSION: usize>(
    s: &str,
) -> Result<crate::format_description::OwnedFormatItem, crate::error::InvalidFormatDescription> {
    validate_version!(VERSION);
    let mut lexed = lexer::lex::<VERSION>(s.as_bytes());
    let ast = ast::parse::<_, VERSION>(&mut lexed);
    let format_items = format_item::parse(ast);
    let items: Box<[format_item::Item<'_>]> = format_items
        .map(|res| res.map(Into::into))
        .collect::<Result<Vec<_>, _>>()?
        .into_boxed_slice();  // Convert Vec into a boxed slice
    Ok(items.into())
}

Save and try the installation again.

You may encounter warnings like the following:

warning: unexpected cfg condition name: nightly
 --> cli\src\lib.rs:1:13
  |
1 | #![cfg_attr(nightly, feature(proc_macro_span))]
  |             ^^^^^^^
  |

For that, run the following code:

rustup toolchain install nightly
rustup default nightly

You may also encounter environment warnings after this. Just manually add the file path on your machine, like this:

win + R, type sysdm.cpl.

Go to the Advanced tab and click on Environment Variables.
Under System variables, scroll down to find Path, then click Edit.

Add the file path:

C:\Users\Username\.avm\bin

Try the installation again.

Restart your terminal and verify installation with:

anchor --version

@muluolantian
Copy link

macOS
I change the rustc version 1.78.0 ( <= 1.80.0), and then fix it .

  1. show all installed rustc versions
    $ rustup toolchain list
    stable-aarch64-apple-darwin
    1.78.0-aarch64-apple-darwin (default)
    ...

  2. change rustc vesrion
    $ rustup default 1.78.0-aarch64-apple-darwin

  3. rustc --version

  4. avm install 0.30.0 # ok

  5. avm use 0.30.0 # ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
avm installation error Issues related to installation errors
Projects
None yet
Development

No branches or pull requests