1

I've got error below when try to run "anchor build"

zsh 1096  (git)-[main]-% anchor build
BPF SDK: /Users/medici/.local/share/solana/install/releases/1.10.31/solana-release/bin/sdk/bpf
cargo-build-bpf child: rustup toolchain list -v
cargo-build-bpf child: cargo +bpf build --target bpfel-unknown-unknown --release
error: command failed: 'cargo': Bad CPU type in executable (os error 86)
  • solana-test-validator is OK
  • anchor init is OK

i use solana 1.10.31 and anchor 0.25.0 installed with avm on mac m1. not sure what cause the problem. anything else i need to do to get anchor build on M1? any ideas please?

1

2 Answers 2

3

The best would be if someone had specific insight on how to troubleshoot and let you build natively (I'd be interested as well), but I have faced this same issue on my M1, and had to fallback to using Rosetta.

This can be done through: softwareupdate --install-rosetta.

Edit: I tried several recent version of solana during the process, to no avail

4
  • just guessing here, but I'd put money on rosetta being the cause, rather than the solution to the problem. OP's error message sounds a lot like attempting to execute and x86_64 binary in an aarch64 runtime environment
    – trent.sol
    Jul 23, 2022 at 17:37
  • could be, although I had that same error and I did not have Rosetta installed at the time
    – man0s
    Jul 23, 2022 at 18:13
  • This solved my issue (+1) Jul 28, 2022 at 10:53
  • yeah, i also ended up with rosetta
    – medici
    Jul 28, 2022 at 15:58
0

I am running Anchor on an M1 and not having any issues. I did not have to take any special steps due to running an M1. Your culprit is likely not hardware related.

2
  • hmm, which version of solana and anchor you use?
    – medici
    Jul 23, 2022 at 13:32
  • anchor = 0.25.0 solana = 1.10.29 Jul 23, 2022 at 14:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.