solana-labs / solana

Web-Scale Blockchain for fast, secure, scalable, decentralized apps and marketplaces.
https://solanalabs.com
Apache License 2.0
13.02k stars 4.19k forks source link

cargo build-bpf does not work on windows #15164

Closed Arrowana closed 2 years ago

Arrowana commented 3 years ago

Problem

cargo build-bpf does not work on windows

It took me a while to understand that it just seems like the command doesn't work on windows or isn't supported https://docs.solana.com/cli/install-solana-cli-tools I installed rust and the solana cli https://github.com/solana-labs/solana-program-library then followed the readme here to build the token program

UserFolder\solana-program-library> cargo build
[...]
UserFolder\solana-program-library\token\program> cargo build-bpf
error: no such subcommand: `build-bpf`

Proposed Solution

  1. If not supported yet, can we have the command return an error at least? Instead of "no such subcommand" leaving the developer wondering if his setup is wrong
  2. If it is supposed to be supported then there is problem a problem to fix :)
jochasinga commented 3 years ago

Problem

cargo build-bpf does not work on windows

It took me a while to understand that it just seems like the command doesn't work on windows or isn't supported https://docs.solana.com/cli/install-solana-cli-tools I installed rust and the solana cli https://github.com/solana-labs/solana-program-library then followed the readme here to build the token program

UserFolder\solana-program-library> cargo build
[...]
UserFolder\solana-program-library\token\program> cargo build-bpf
error: no such subcommand: `build-bpf`

Proposed Solution

  1. If not supported yet, can we have the command return an error at least? Instead of "no such subcommand" leaving the developer wondering if his setup is wrong
  2. If it is supposed to be supported then there is problem a problem to fix :)

Did you check if the executable cargo-build-bpf is located within your $PATH and that cargo build-bpf is run in a directory with Cargo.toml? https://github.com/rust-lang/cargo/wiki/Third-party-cargo-subcommands

mvines commented 3 years ago

Yes we currently don't support native windows for cargo-build-bpf unfortunately. Would using WSL be an option?

Arrowana commented 3 years ago

@mvines I switched to a full setup in WSL, then I can develop. I don't think requiring WSL for a windows setup is great, the developer should be free to go for full Windows or full Linux (through WSL if he wants to).

Since windows can be used to do most of the other things, it seems like this subcommand has to exist but throw something, so solution 1. What do you think?

Is this as simple as adding cargo-build-bpf in https://github.com/solana-labs/solana/blob/master/scripts/cargo-install-all.sh#L62-L68 then having a simple executable which can print "build-bpf not supported on windows" that we build on windows instead of the real one?

mvines commented 3 years ago

Is this as simple as adding cargo-build-bpf in https://github.com/solana-labs/solana/blob/master/scripts/cargo-install-all.sh#L62-L68 then having a simple executable which can print "build-bpf not supported on windows" that we build on windows instead of the real one?

Yep, this would be a fine solution until native windows support for development is available.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

joncinque commented 2 years ago

This was fixed in https://github.com/solana-labs/solana/pull/20276 -- it currently requires a bash-compatible shell, but at least it's a start!

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any activity in past 7 days after it was closed. Please open a new issue for related bugs.