Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Install spl-token-cli v4.0.0 failed #7043

@nealsun

Description

@nealsun

I'm using cargo install spl-token-cli to install token-cli, but I got error below

Compiling spl-type-length-value v0.4.5
error[E0277]: `?` couldn't convert the error to `solana_program::program_error::ProgramError`
  --> /Users/aaron/.cargo/registry/src/index.crates.io-6f17d22bba15001f/spl-type-length-value-0.4.5/src/state.rs:67:99
   |
39 | ) -> Result<TlvIndices, ProgramError> {
   |      -------------------------------- expected `solana_program::program_error::ProgramError` because of this
...
67 |             pod_from_bytes::<Length>(&tlv_data[tlv_indices.length_start..tlv_indices.value_start])?;
   |             --------------------------------------------------------------------------------------^ the trait `From<spl_pod::solana_program::program_error::ProgramError>` is not implemented for `solana_program::program_error::ProgramError`, which is required by `Result<TlvIndices, solana_program::program_error::ProgramError>: FromResidual<Result<Infallible, spl_pod::solana_program::program_error::ProgramError>>`
   |             |
   |             this can't be annotated with `?` because it has type `Result<_, spl_pod::solana_program::program_error::ProgramError>`
   |
   = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
   = help: the following other types implement trait `From<T>`:
             <solana_program::program_error::ProgramError as From<TlvError>>
             <solana_program::program_error::ProgramError as From<solana_program::pubkey::PubkeyError>>
             <solana_program::program_error::ProgramError as From<std::io::Error>>
             <solana_program::program_error::ProgramError as From<u64>>
   = note: required for `Result<TlvIndices, solana_program::program_error::ProgramError>` to implement `FromResidual<Result<Infallible, spl_pod::solana_program::program_error::ProgramError>>`

error[E0277]: `?` couldn't convert the error to `solana_program::program_error::ProgramError`
   --> /Users/aaron/.cargo/registry/src/index.crates.io-6f17d22bba15001f/spl-type-length-value-0.4.5/src/state.rs:109:14
    |
80  |   ) -> Result<(Vec<ArrayDiscriminator>, usize), ProgramError> {
    |        ------------------------------------------------------ expected `solana_program::program_error::ProgramError` because of this
...
107 |               let length = pod_from_bytes::<Length>(
    |  __________________________-
108 | |                 &tlv_data[tlv_indices.length_start..tlv_indices.value_start],
109 | |             )?;
    | |             -^ the trait `From<spl_pod::solana_program::program_error::ProgramError>` is not implemented for `solana_program::program_error::ProgramError`, which is required by `Result<(Vec<ArrayDiscriminator>, usize), solana_program::program_error::ProgramError>: FromResidual<Result<Infallible, spl_pod::solana_program::program_error::ProgramError>>`
    | |_____________|
    |               this can't be annotated with `?` because it has type `Result<_, spl_pod::solana_program::program_error::ProgramError>`
    |
    = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
    = help: the following other types implement trait `From<T>`:
              <solana_program::program_error::ProgramError as From<TlvError>>
              <solana_program::program_error::ProgramError as From<solana_program::pubkey::PubkeyError>>
              <solana_program::program_error::ProgramError as From<std::io::Error>>
              <solana_program::program_error::ProgramError as From<u64>>
    = note: required for `Result<(Vec<ArrayDiscriminator>, usize), solana_program::program_error::ProgramError>` to implement `FromResidual<Result<Infallible, spl_pod::solana_program::program_error::ProgramError>>`

error[E0277]: `?` couldn't convert the error to `solana_program::program_error::ProgramError`
   --> /Users/aaron/.cargo/registry/src/index.crates.io-6f17d22bba15001f/spl-type-length-value-0.4.5/src/state.rs:141:80
    |
127 | ) -> Result<&[u8], ProgramError> {
    |      --------------------------- expected `solana_program::program_error::ProgramError` because of this
...
141 |     let length = pod_from_bytes::<Length>(&tlv_data[length_start..value_start])?;
    |                  --------------------------------------------------------------^ the trait `From<spl_pod::solana_program::program_error::ProgramError>` is not implemented for `solana_program::program_error::ProgramError`, which is required by `Result<&[u8], solana_program::program_error::ProgramError>: FromResidual<Result<Infallible, spl_pod::solana_program::program_error::ProgramError>>`
    |                  |
    |                  this can't be annotated with `?` because it has type `Result<_, spl_pod::solana_program::program_error::ProgramError>`
    |
    = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
    = help: the following other types implement trait `From<T>`:
              <solana_program::program_error::ProgramError as From<TlvError>>
              <solana_program::program_error::ProgramError as From<solana_program::pubkey::PubkeyError>>
              <solana_program::program_error::ProgramError as From<std::io::Error>>
              <solana_program::program_error::ProgramError as From<u64>>
    = note: required for `Result<&[u8], solana_program::program_error::ProgramError>` to implement `FromResidual<Result<Infallible, spl_pod::solana_program::program_error::ProgramError>>`

error[E0308]: mismatched types
   --> /Users/aaron/.cargo/registry/src/index.crates.io-6f17d22bba15001f/spl-type-length-value-0.4.5/src/state.rs:216:9
    |
214 |     ) -> Result<&V, ProgramError> {
    |          ------------------------ expected `Result<&V, solana_program::program_error::ProgramError>` because of return type
215 |         let data = get_bytes::<V>(self.get_data(), repetition_number)?;
216 |         pod_from_bytes::<V>(data)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `ProgramError`, found a different `ProgramError`
    |
    = note: `ProgramError` and `ProgramError` have similar names, but are actually distinct types
note: `ProgramError` is defined in crate `solana_program`
   --> /Users/aaron/.cargo/registry/src/index.crates.io-6f17d22bba15001f/solana-program-2.0.1/src/program_error.rs:15:1
    |
15  | pub enum ProgramError {
    | ^^^^^^^^^^^^^^^^^^^^^
note: `ProgramError` is defined in crate `solana_program`
   --> /Users/aaron/.cargo/registry/src/index.crates.io-6f17d22bba15001f/solana-program-1.18.19/src/program_error.rs:14:1
    |
14  | pub enum ProgramError {
    | ^^^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `solana_program` are being used?

error[E0308]: mismatched types
   --> /Users/aaron/.cargo/registry/src/index.crates.io-6f17d22bba15001f/spl-type-length-value-0.4.5/src/state.rs:333:9
    |
331 |     ) -> Result<&mut V, ProgramError> {
    |          ---------------------------- expected `Result<&mut V, solana_program::program_error::ProgramError>` because of return type
332 |         let data = self.get_bytes_with_repetition_mut::<V>(repetition_number)?;
333 |         pod_from_bytes_mut::<V>(data)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `ProgramError`, found a different `ProgramError`
    |
    = note: `ProgramError` and `ProgramError` have similar names, but are actually distinct types
note: `ProgramError` is defined in crate `solana_program`
   --> /Users/aaron/.cargo/registry/src/index.crates.io-6f17d22bba15001f/solana-program-2.0.1/src/program_error.rs:15:1
    |
15  | pub enum ProgramError {
    | ^^^^^^^^^^^^^^^^^^^^^
note: `ProgramError` is defined in crate `solana_program`
   --> /Users/aaron/.cargo/registry/src/index.crates.io-6f17d22bba15001f/solana-program-1.18.19/src/program_error.rs:14:1
    |
14  | pub enum ProgramError {
    | ^^^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `solana_program` are being used?

error[E0277]: `?` couldn't convert the error to `solana_program::program_error::ProgramError`
   --> /Users/aaron/.cargo/registry/src/index.crates.io-6f17d22bba15001f/spl-type-length-value-0.4.5/src/state.rs:362:85
    |
362 |         let length = pod_from_bytes::<Length>(&self.data[length_start..value_start])?;
    |                                                                                     ^ the trait `From<spl_pod::solana_program::program_error::ProgramError>` is not implemented for `solana_program::program_error::ProgramError`, which is required by `Result<&mut [u8], solana_program::program_error::ProgramError>: FromResidual<Result<Infallible, spl_pod::solana_program::program_error::ProgramError>>`
    |
    = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
    = help: the following other types implement trait `From<T>`:
              <solana_program::program_error::ProgramError as From<TlvError>>
              <solana_program::program_error::ProgramError as From<solana_program::pubkey::PubkeyError>>
              <solana_program::program_error::ProgramError as From<std::io::Error>>
              <solana_program::program_error::ProgramError as From<u64>>
    = note: required for `Result<&mut [u8], solana_program::program_error::ProgramError>` to implement `FromResidual<Result<Infallible, spl_pod::solana_program::program_error::ProgramError>>`

error[E0277]: `?` couldn't convert the error to `solana_program::program_error::ProgramError`
   --> /Users/aaron/.cargo/registry/src/index.crates.io-6f17d22bba15001f/spl-type-length-value-0.4.5/src/state.rs:387:60
    |
387 |         let extension_ref = pod_from_bytes_mut::<V>(buffer)?;
    |                                                            ^ the trait `From<spl_pod::solana_program::program_error::ProgramError>` is not implemented for `solana_program::program_error::ProgramError`, which is required by `Result<(&mut V, usize), solana_program::program_error::ProgramError>: FromResidual<Result<Infallible, spl_pod::solana_program::program_error::ProgramError>>`
    |
    = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
    = help: the following other types implement trait `From<T>`:
              <solana_program::program_error::ProgramError as From<TlvError>>
              <solana_program::program_error::ProgramError as From<solana_program::pubkey::PubkeyError>>
              <solana_program::program_error::ProgramError as From<std::io::Error>>
              <solana_program::program_error::ProgramError as From<u64>>
    = note: required for `Result<(&mut V, usize), solana_program::program_error::ProgramError>` to implement `FromResidual<Result<Infallible, spl_pod::solana_program::program_error::ProgramError>>`

error[E0277]: `?` couldn't convert the error to `solana_program::program_error::ProgramError`
   --> /Users/aaron/.cargo/registry/src/index.crates.io-6f17d22bba15001f/spl-type-length-value-0.4.5/src/state.rs:439:88
    |
439 |                 pod_from_bytes_mut::<Length>(&mut self.data[length_start..value_start])?;
    |                                                                                        ^ the trait `From<spl_pod::solana_program::program_error::ProgramError>` is not implemented for `solana_program::program_error::ProgramError`, which is required by `Result<(&mut [u8], usize), solana_program::program_error::ProgramError>: FromResidual<Result<Infallible, spl_pod::solana_program::program_error::ProgramError>>`
    |
    = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
    = help: the following other types implement trait `From<T>`:
              <solana_program::program_error::ProgramError as From<TlvError>>
              <solana_program::program_error::ProgramError as From<solana_program::pubkey::PubkeyError>>
              <solana_program::program_error::ProgramError as From<std::io::Error>>
              <solana_program::program_error::ProgramError as From<u64>>
    = note: required for `Result<(&mut [u8], usize), solana_program::program_error::ProgramError>` to implement `FromResidual<Result<Infallible, spl_pod::solana_program::program_error::ProgramError>>`

error[E0277]: `?` couldn't convert the error to `solana_program::program_error::ProgramError`
   --> /Users/aaron/.cargo/registry/src/index.crates.io-6f17d22bba15001f/spl-type-length-value-0.4.5/src/state.rs:490:97
    |
490 |         let length_ref = pod_from_bytes_mut::<Length>(&mut self.data[length_start..value_start])?;
    |                                                                                                 ^ the trait `From<spl_pod::solana_program::program_error::ProgramError>` is not implemented for `solana_program::program_error::ProgramError`, which is required by `Result<&mut [u8], solana_program::program_error::ProgramError>: FromResidual<Result<Infallible, spl_pod::solana_program::program_error::ProgramError>>`
    |
    = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
    = help: the following other types implement trait `From<T>`:
              <solana_program::program_error::ProgramError as From<TlvError>>
              <solana_program::program_error::ProgramError as From<solana_program::pubkey::PubkeyError>>
              <solana_program::program_error::ProgramError as From<std::io::Error>>
              <solana_program::program_error::ProgramError as From<u64>>
    = note: required for `Result<&mut [u8], solana_program::program_error::ProgramError>` to implement `FromResidual<Result<Infallible, spl_pod::solana_program::program_error::ProgramError>>`

error[E0277]: `?` couldn't convert the error to `solana_program::program_error::ProgramError`
   --> /Users/aaron/.cargo/registry/src/index.crates.io-6f17d22bba15001f/spl-type-length-value-0.4.5/src/state.rs:556:84
    |
547 | ) -> Result<(), ProgramError> {
    |      ------------------------ expected `solana_program::program_error::ProgramError` because of this
...
556 |         usize::try_from(*pod_from_bytes::<Length>(&data[length_start..value_start])?)?
    |                          ----------------------------------------------------------^ the trait `From<spl_pod::solana_program::program_error::ProgramError>` is not implemented for `solana_program::program_error::ProgramError`, which is required by `Result<(), solana_program::program_error::ProgramError>: FromResidual<Result<Infallible, spl_pod::solana_program::program_error::ProgramError>>`
    |                          |
    |                          this can't be annotated with `?` because it has type `Result<_, spl_pod::solana_program::program_error::ProgramError>`
    |
    = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
    = help: the following other types implement trait `From<T>`:
              <solana_program::program_error::ProgramError as From<TlvError>>
              <solana_program::program_error::ProgramError as From<solana_program::pubkey::PubkeyError>>
              <solana_program::program_error::ProgramError as From<std::io::Error>>
              <solana_program::program_error::ProgramError as From<u64>>
    = note: required for `Result<(), solana_program::program_error::ProgramError>` to implement `FromResidual<Result<Infallible, spl_pod::solana_program::program_error::ProgramError>>`

Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `spl-type-length-value` (lib) due to 10 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `spl-token-cli v4.0.0`, intermediate artifacts can be found at `/var/folders/_r/hsj6gn5n0fvfzrxs0sw6p4f00000gn/T/cargo-installFvUmY8`.

how to fix this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions