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

idl-build = ["anchor-lang/idl-build"] - cause compilation error #2745

Closed
ohaddahan opened this issue Dec 23, 2023 · 6 comments
Closed

idl-build = ["anchor-lang/idl-build"] - cause compilation error #2745

ohaddahan opened this issue Dec 23, 2023 · 6 comments
Labels
idl related to the IDL, either program or client side

Comments

@ohaddahan
Copy link

If I'm using idl-build = ["anchor-lang/idl-build"] I'm getting compilation errors.
Once removed, compiles fine.

error[E0599]: no associated item named `__anchor_private_gen_idl_type` found for struct `anchor_spl::token::TokenAccount` in the current scope
  --> programs/<>/src/instructions/car/<>.rs:15:10
   |
15 | #[derive(Accounts)]
   |          ^^^^^^^^ associated item not found in `TokenAccount`
   |
   = note: this error originates in the derive macro `Accounts` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you are looking for the module in `std`, not the primitive type
   |
15 | #[derive(std::Accounts)]
   |          +++++
[package]
name = "<>"
version = "0.1.0"
description = "Created with Anchor"
edition = "2021"

[lib]
crate-type = ["cdylib", "lib"]
name = "matchbox"

[features]
no-entrypoint = []
no-idl = []
no-log-ix-name = []
cpi = ["no-entrypoint"]
default = []
idl-build = ["anchor-lang/idl-build"]

[dependencies]
anchor-lang = { version = "0.29.0", features = ["init-if-needed"] }
anchor-spl = { version = "0.29.0", features = ["spl-associated-token-account", "spl-token", "metadata"] }
arrayref = "0.3.7"
[package]
name = "<>"
version = "0.1.0"
description = "Created with Anchor"
edition = "2021"

[lib]
crate-type = ["cdylib", "lib"]
name = "matchbox"

[features]
no-entrypoint = []
no-idl = []
no-log-ix-name = []
cpi = ["no-entrypoint"]
default = []

[dependencies]
anchor-lang = { version = "0.29.0", features = ["init-if-needed"] }
anchor-spl = { version = "0.29.0", features = ["spl-associated-token-account", "spl-token", "metadata"] }
arrayref = "0.3.7"
@acheroncrypto
Copy link
Collaborator

This is happening because all crates that you use types from need to be specified in the idl-build feature list:

[features]
idl-build = [
    "anchor-lang/idl-build",
    "anchor-spl/idl-build",
]

More details in release notes.

@acheroncrypto acheroncrypto added the idl related to the IDL, either program or client side label Dec 23, 2023
@ohaddahan
Copy link
Author

release notes

Oh, missed that.
The error message was cryptic :)

@acheroncrypto
Copy link
Collaborator

Yeah, definitely cryptic — we should improve it.

@bunnyBites
Copy link

This is happening because all crates that you use types from need to be specified in the idl-build feature list:

[features]
idl-build = [
    "anchor-lang/idl-build",
    "anchor-spl/idl-build",
]

More details in release notes.

I don't believe I spent a week trying different anchor versions and solana versions to fix this.

@solguru310
Copy link

Thanks @acheroncrypto .
I solved my error by your comment.
fully recommend you.

@0xl3on
Copy link

0xl3on commented Nov 5, 2024

This is happening because all crates that you use types from need to be specified in the idl-build feature list:

[features]
idl-build = [
    "anchor-lang/idl-build",
    "anchor-spl/idl-build",
]

More details in release notes.

thank you!!

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

No branches or pull requests

5 participants