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

Fail to compile anchor with metadata #3554

Open
RobertEyler opened this issue Feb 12, 2025 · 2 comments
Open

Fail to compile anchor with metadata #3554

RobertEyler opened this issue Feb 12, 2025 · 2 comments

Comments

@RobertEyler
Copy link

Description

Yesterday I re-pulled the code on another computer. The following problem occurred during compilation

version

0.30.1

system

ubuntu

error

error[E0433]: failed to resolve: use of undeclared crate or module serde
--> /home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mpl-token-metadata-4.1.2/src/generated/accounts/metadata.rs:20:11
|
20 | #[ derive(serde::Serialize, serde::Deserialize)]
| ^^^^^ use of undeclared crate or module serde

error[E0433]: failed to resolve: use of undeclared crate or module serde
--> /home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mpl-token-metadata-4.1.2/src/generated/accounts/metadata.rs:20:29
|
20 | #[ derive(serde::Serialize, serde::Deserialize)]
| ^^^^^ use of undeclared crate or module serde

error[E0599]: no function or associated item named deserialize found for struct metadata::Metadata in the current scope
--> /home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mpl-token-metadata-4.1.2/src/generated/accounts/metadata.rs:88:15
|
22 | pub struct Metadata {
| ------------------- function or associated item deserialize not found for this struct
...
88 | Self::deserialize(&mut data)
| ^^^^^^^^^^^ function or associated item not found in Metadata

@wbreeze
Copy link

wbreeze commented Feb 13, 2025

What code is this that you re-pulled? by what process did you do that?What is the command that you used to compile? that generated the output you are showing?

@RobertEyler
Copy link
Author

what command I build

I use anchor build.

dependencies

anchor-lang = {version="0.30.1", features = ["init-if-needed"]}
anchor-spl = { version = "0.30.1", features = ["metadata"] }

code

#[derive(Accounts)]
pub struct Create<'info>{
    pub metadata_program: Program<'info, Metadata>
}

The code can build on my other computer that startup the project on January.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants