0

Tackling the error below trying to compile my anchor program

Error: Function _ZN112_$LT$solana_program..instruction..InstructionError$u20$as$u20$solana_frozen_abi..abi_example..AbiEnumVisitor$GT$13visit_for_abi17h644e86fc07351350E Stack offset of 4608 exceeded max offset of 4096 by 512 bytes, please minimize large stack variables
   Compiling anchor-lang v0.28.0
   Compiling spl-token-2022 v0.9.0
error[E0277]: can't compare `solana_program::pubkey::Pubkey` with `spl_memo::solana_program::pubkey::Pubkey`
  --> src/extension/memo_transfer/mod.rs:42:20
   |
42 |         program_id == &spl_memo::id() || program_id == &spl_memo::v1::id()
   |                    ^^ no implementation for `solana_program::pubkey::Pubkey == spl_memo::solana_program::pubkey::Pubkey`
   |
   = help: the trait `PartialEq<spl_memo::solana_program::pubkey::Pubkey>` is not implemented for `solana_program::pubkey::Pubkey`
   = help: the trait `PartialEq` is implemented for `solana_program::pubkey::Pubkey`
   = help: for that trait implementation, expected `solana_program::pubkey::Pubkey`, found `spl_memo::solana_program::pubkey::Pubkey`
   = note: required for `&solana_program::pubkey::Pubkey` to implement `PartialEq<&spl_memo::solana_program::pubkey::Pubkey>`

error[E0277]: can't compare `solana_program::pubkey::Pubkey` with `spl_memo::solana_program::pubkey::Pubkey`
  --> src/extension/memo_transfer/mod.rs:42:53
   |
42 |         program_id == &spl_memo::id() || program_id == &spl_memo::v1::id()
   |                                                     ^^ no implementation for `solana_program::pubkey::Pubkey == spl_memo::solana_program::pubkey::Pubkey`
   |
   = help: the trait `PartialEq<spl_memo::solana_program::pubkey::Pubkey>` is not implemented for `solana_program::pubkey::Pubkey`
   = help: the trait `PartialEq` is implemented for `solana_program::pubkey::Pubkey`
   = help: for that trait implementation, expected `solana_program::pubkey::Pubkey`, found `spl_memo::solana_program::pubkey::Pubkey`
   = note: required for `&solana_program::pubkey::Pubkey` to implement `PartialEq<&spl_memo::solana_program::pubkey::Pubkey>`

error[E0599]: no function or associated item named `get_packed_len` found for struct `spl_token::state::Account` in the current scope
   --> src/state.rs:306:57
    |
306 |                         .get(spl_token::state::Account::get_packed_len())
    |                                                         ^^^^^^^^^^^^^^ function or associated item not found in `Account`
    |
    = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
3   + use spl_memo::solana_program::program_pack::Pack;
    |

error[E0277]: can't compare `solana_program::pubkey::Pubkey` with `spl_memo::solana_program::pubkey::Pubkey`
   --> src/lib.rs:106:62
    |
106 |     if spl_token_program_id != &id() && spl_token_program_id != &spl_token::id() {
    |                                                              ^^ no implementation for `solana_program::pubkey::Pubkey == spl_memo::solana_program::pubkey::Pubkey`
    |
    = help: the trait `PartialEq<spl_memo::solana_program::pubkey::Pubkey>` is not implemented for `solana_program::pubkey::Pubkey`
    = help: the trait `PartialEq` is implemented for `solana_program::pubkey::Pubkey`
    = help: for that trait implementation, expected `solana_program::pubkey::Pubkey`, found `spl_memo::solana_program::pubkey::Pubkey`
    = note: required for `&solana_program::pubkey::Pubkey` to implement `PartialEq<&spl_memo::solana_program::pubkey::Pubkey>`

Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `spl-token-2022` (lib) due to 4 previous errors
warning: build failed, waiting for other jobs to finish...

My environment looks like this

solana-cli 2.0.4 (src:0b1143e1; feat:2304137539, client:Agave)

anchor-cli 0.28.0

My program's Cargo.toml dependencies

[dependencies]
anchor-lang = "0.28.0"
mpl-core-candy-guard = "0.2.1"
mpl-core-candy-machine-core = "0.2.1"
solana-program="=1.16.21" 

1 Answer 1

1

It's tough to tell without more info, but for some reason your build is saying that solana_program::pubkey::Pubkey == spl_memo::solana_program::pubkey::Pubkey is not implemented, so the version of solana_program used by spl_memo is considered different from the base solana_program.

Take a look through your Cargo.lock to see if one of them is pulling in v2 of solana-program, causing the discrepancy. Everything else looks ok based on the Cargo.toml, but cargo does unexpected things sometimes.

1
  • I downgrade token-22 and spl token crates and that seems to have solved it.
    – Jimii
    Commented yesterday

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.