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 build fails to generate IDL with inconsistent errors #3457

Open
winary opened this issue Dec 27, 2024 · 2 comments
Open

anchor build fails to generate IDL with inconsistent errors #3457

winary opened this issue Dec 27, 2024 · 2 comments
Labels
bug Something isn't working idl related to the IDL, either program or client side

Comments

@winary
Copy link

winary commented Dec 27, 2024

On a macOS system with Apple M3, the build environment includes:

  • solana-cargo-build-sbf version 2.0.20
  • platform-tools version 1.42
  • Rustc version 1.75.0
  • anchor-cli version 0.30.1

When running anchor build, the .so file is successfully generated, but the IDL file is not created. Over multiple builds, the following errors appear inconsistently:

  1. Error: invalid number at line 1 column 2
  2. Error: invalid type: map, expected a sequence at line 1 column 0
  3. Error: IDL doesn't exist
  4. Error: invalid type: string "\"CcZxqWCzQtNeCNbffRTnJtSXahNkoccn3K3N6mzwfXsE\"", expected struct IdlConst at line 1 column 50

It seems the build process is unstable and fails to generate a valid IDL file.

@acheroncrypto acheroncrypto added bug Something isn't working idl related to the IDL, either program or client side labels Dec 29, 2024
@acheroncrypto
Copy link
Collaborator

Do you have a reproducable example? I've never seen this error reported before.

It also seems unlikely to me that this would be related to Apple M3, since we just run cargo test with specific flags and capture the output of that command to generate the IDL.

@winary
Copy link
Author

winary commented Dec 30, 2024

demo1: avm use 0.29.0 && anchor init demo1 && cd demo1 && anchor build
demo2: avm use 0.30.1 && anchor init demo2 && cd demo2 && anchor build

it works well at demo1, build successfuly and generate idl file

and demo2 also build successfuly but fail to generate idl file, will get error Error: IDL doesn't exist, after I try several times, it shows different errors like above

solana-cargo-build-sbf 1.18.26
platform-tools v1.41
rustc 1.75.0

anchor-cli 0.30.1

solana-cli 1.18.26 (src:d9f20e95; feat:3241752014, client:SolanaLabs)

@acheroncrypto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working idl related to the IDL, either program or client side
Projects
None yet
Development

No branches or pull requests

2 participants