coral-xyz / anchor

⚓ Solana Sealevel Framework
https://anchor-lang.com
Apache License 2.0
3.4k stars 1.27k forks source link

`% anchor test` error: no such command: `build-bpf` #2487

Open aliscie opened 1 year ago

aliscie commented 1 year ago

I am using MAC M1 and I just installed solana and anchor. No idea how to solve this? I also tried cargo install solana-cargo-build-bpf but I got error error: could not findsolana-cargo-build-bpfin registrycrates-iowith version*``

acheroncrypto commented 1 year ago

What is your solana version?

aliscie commented 1 year ago

What is your solana version?

solana-cli 1.13.8 (src:43daa379; feat:1775889670)

acheroncrypto commented 1 year ago

What's the output of cargo build-bpf --version? I'd also try with latest solana version(1.14.17).

aliscie commented 1 year ago

cargo build-bpf --version

cargo build-bpf --version
error: no such command: `build-bpf`

        View all installed commands with `cargo --list`

Also, I installed solana using sh -c "$(curl -sSfL https://release.solana.com/v1.15.2/install)" How can I choose a later version.

acheroncrypto commented 1 year ago

Also, I installed solana using sh -c "$(curl -sSfL https://release.solana.com/v1.15.2/install)" How can I choose a later version.

You can change the version in the link to whichever version you want. There is also solana-install init <VERSION> command if you already have solana installed.

This seems like a solana installation issue rather than Anchor issue.

Make sure active release of solana is in your $PATH and try using anchor test --arch sbf since build-bpf is getting deprecated anyway.

aliscie commented 1 year ago

Also, I installed solana using sh -c "$(curl -sSfL https://release.solana.com/v1.15.2/install)" How can I choose a later version.

You can change the version in the link to whichever version you want. There is also solana-install init <VERSION> command if you already have solana installed.

This seems like a solana installation issue rather than Anchor issue.

Make sure active release of solana is in your $PATH and try using anchor test --arch sbf since build-bpf is getting deprecated anyway.

@acheroncrypto We need dfinity ICP smart contract developer would you like to join our team?

aliscie commented 1 year ago

Now

solana --version
solana-cli 1.15.2 (src:dea65f48; feat:1211687720, client:SolanaLabs)

but I am still facing the same issue. Also, anchor test --arch sbf yield

error: Found argument '--arch' which wasn't expected, or isn't valid in this context

  If you tried to supply '--arch' as a value rather than a flag, use '-- --arch'

Usage: anchor test [OPTIONS] [ARGS]... [-- <CARGO_ARGS>...]

For more information try '--help'
ZafarMansoori commented 1 year ago

Any update on this i still face same problem

Tabishhaider72 commented 1 year ago

Now

solana --version
solana-cli 1.15.2 (src:dea65f48; feat:1211687720, client:SolanaLabs)

but I am still facing the same issue. Also, anchor test --arch sbf yield

error: Found argument '--arch' which wasn't expected, or isn't valid in this context

  If you tried to supply '--arch' as a value rather than a flag, use '-- --arch'

Usage: anchor test [OPTIONS] [ARGS]... [-- <CARGO_ARGS>...]

For more information try '--help'

It seems there was a misunderstanding. The --arch sbf flag you mentioned is not a valid flag for the anchor test command. for the test environment, you can try this command: anchor test -- --arch sbf If you encounter any further issues or have additional questions, please let me know

DaviRain-Su commented 10 months ago

Why add --arch, just run anchor test is ok.

SergioArrighi commented 6 months ago

Hey guys, I am having the same issue. I have recently installed rustc and solana. I wanted to try out anchor but I am facing this issue building basically the empty project after initialization. solana-cli 1.16.24 (src:00000000; feat:4033350765, client:SolanaLabs) rustc 1.75.0 (82e1608df 2023-12-21) 0.29.0 (latest, installed, current)

I installed anchor using avm.

Basically when I execute build I get

error: no such command: build-bpf View all installed commands with cargo --list Find a package to install build-bpf with `cargo search cargo-build-bpf

I think this is from package solana-cargo-build-bpf which has been yonked.

Can you please assist?

Thanks and best regards

prasmalla commented 5 months ago

came across this issue and realized the solana-cli was not being loaded in my env correctly. fixed the path and anchor build runs as expected

j-som commented 2 months ago

my solana version is solana-cli 1.17.25 (src:d0ed878d; feat:3580551090, client:SolanaLabs) I found solana installer set the follow line to $HOME/.profile

export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"

and this file will be run when you login, so you need to relogin or reboot to make the change effective.