1

Question1:

anchor build got error: Stack offset of 4608 exceeded max offset of 4096 ... if let solana v1.18.10 present in ENV/PATH

 ❱❱❱ which solana
/mnt/volume2/solana_dev_env/v1.18.10/solana-release/bin/solana
 ❱❱❱  echo $PATH         
/mnt/volume2/solana_dev_env/v1.18.10/solana-release/bin:/home/ubuntu/.cargo/bin:/usr/local/sbin: ...
(events) ❱❱❱ anchor build                                                   
info: uninstalling toolchain 'solana'
info: toolchain 'solana' uninstalled
warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions
   Compiling proc-macro2 v1.0.79

...

   Compiling anchor-attribute-program v0.28.0
   Compiling anchor-attribute-error v0.28.0
   Compiling anchor-derive-space v0.28.0
   Compiling base64 v0.13.1
Error: Function _ZN112_$LT$solana_program..instruction..InstructionError$u20$as$u20$solana_frozen_abi..abi_example..AbiEnumVisitor$GT$13visit_for_abi17hd196cb48ec8b8db8E Stack offset of 4608 exceeded max offset of 4096 by 512 bytes, please minimize large stack variables
Error: Function _ZN108_$LT$solana_program..vote..state..CircBuf$LT$I$GT$$u20$as$u20$solana_frozen_abi..abi_example..AbiExample$GT$7example17h4b696142e261c9f4E Stack offset of 4640 exceeded max offset of 4096 by 544 bytes, please minimize large stack variables
   Compiling anchor-lang v0.28.0
            ...

but anchor build build output .so file without error if let v1.16.25 solana present in ENV/PATH.

(events) ❱❱❱  solana --version
solana-cli 1.16.25 (src:8dd7d060; feat:2294205250, client:SolanaLabs)
(events) ❱❱❱ anchor build 
info: uninstalling toolchain 'solana'
            ...

Need to mention that, in both case, my anchor cli version is 0.29.0

(events) ❱❱❱ anchor --version
anchor-cli 0.29.0 
(events) ❱❱❱ which anchor
/home/ubuntu/.cargo/bin/anchor 
(events) ❱❱❱ 

Question2: This is my first time notice the build log "uninstalling toolchain 'solana' ", what does it mean? does anchor build action remove old solana and installed it's own solana ? I doubt. but this log message puzzled me.

(events) ❱❱❱ anchor build                                                   
info: uninstalling toolchain 'solana'
info: toolchain 'solana' uninstalled

1 Answer 1

1

Copying my answer at https://github.com/anza-xyz/agave/issues/1285:

Be sure to use the newest solana-program crate in your project if you don't want the error, since this was fixed awhile ago. Here's the fixed state in 1.18 in https://github.com/anza-xyz/agave/blob/f3fa655000c8f436eac0283ef71be1fe1211eb41/sdk/program/src/instruction.rs#L31

On top of that, I can guarantee that your program compiled successfully, so you can feel free to use it even when those errors are reported.

1
  • Thanks. I try again, use v1.18 solana cli and still got same error. Then I found the root cause is my project's Cargo.lock file, it was stale, delete it and redo build then success. Commented May 22 at 9:53

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.