I am using OSX with the following packages:
Anchor CLI 0.28.0
Rust 1.70.0
Solana CLI 1.16.1
To flush cache and ensure my environment is clean I have run:
anchor clean && cargo update
These are my project dependencies:
[dependencies]
anchor-lang = { version = "0.28.0", features = ["init-if-needed"] }
anchor-spl = { version = "0.28.0", features = ["metadata"] }
solana-program = "1.14.19"
mpl-token-metadata = { version = "1.12.0", features = ["no-entrypoint"] }
But when I run anchor build
, it throws multiple errors like the following:
error[E0277]: the trait bound `Pubkey: BorshSerialize` is not satisfied
--> src/idl.rs:35:10
|
35 | #[derive(AnchorSerialize, AnchorDeserialize)]
| ^^^^^^^^^^^^^^^ the trait `BorshSerialize` is not implemented for `Pubkey`
|
= help: the following other types implement trait `BorshSerialize`:
&T
()
(T0, T1)
(T0, T1, T2)
(T0, T1, T2, T3)
(T0, T1, T2, T3, T4)
(T0, T1, T2, T3, T4, T5)
(T0, T1, T2, T3, T4, T5, T6)
and 81 others
This is the Cargo.lock
file showing the anchor-lang
installed dependencies:
[[package]]
name = "anchor-lang"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d2d4b20100f1310a774aba3471ef268e5c4ba4d5c28c0bbe663c2658acbc414"
dependencies = [
"anchor-attribute-access-control",
"anchor-attribute-account",
"anchor-attribute-constant",
"anchor-attribute-error",
"anchor-attribute-event",
"anchor-attribute-program",
"anchor-derive-accounts",
"anchor-derive-space",
"arrayref",
"base64 0.13.1",
"bincode",
"borsh 0.10.3",
"bytemuck",
"getrandom 0.2.10",
"solana-program",
"thiserror",
]
Seems like anchor-lang
is using a conflicting borsh version 0.10.3
when it should be using 0.9.3
. Does anyone know a workaround to fix this issue?