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

anchor test fails silently when using lazy_static #3403

Open
ssadler opened this issue Dec 3, 2024 · 1 comment
Open

anchor test fails silently when using lazy_static #3403

ssadler opened this issue Dec 3, 2024 · 1 comment
Labels
bug Something isn't working cli

Comments

@ssadler
Copy link

ssadler commented Dec 3, 2024

I wanted to have a top level variable with a non const init in my program, I introduced lazy_static crate, and tests started to fail with the error "program is not deployed". There was also no indication of the problem in .anchor/test-ledger/validator.log.

I tracked it down by starting the validator separately with solana-test-validator and running anchor deploy. Then I saw the same error as in this issue (longer than 16 bytes): https://solana.stackexchange.com/questions/13628/error-elf-error-elf-error-failed-to-parse-elf-file-section-or-symbol-name.

@acheroncrypto acheroncrypto added bug Something isn't working cli labels Dec 7, 2024
@acheroncrypto
Copy link
Collaborator

The behavior is coming from solana-test-validator since anchor test uses that to deploy your program (include the program in genesis rather than "deploy" to be exact).

I also wonder why this is not a compile error, given it's clearly a restricted functionality.

In any case, we might be able to fix it from our side by checking the ELF, but it would be better if this issue gets fixed upstream (either via build tools or solana-test-validator).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli
Projects
None yet
Development

No branches or pull requests

2 participants