Reputation: 43
I am trying to build a Rust project and when I try to execute cargo build-bpf --manifest-path=contracts/solana/program/Cargo.toml --bpf-out-dir=dist/solana/program
in the terminal I got this error:
Can't get home directory path: environment variable not found
Any ideas about how to solve it?
Upvotes: 1
Views: 8235
Reputation: 8412
cargo build-bpf
requires the HOME
environment variable to be set to work. To resolve this, you have a few options:
HOME
will always be set. More information about how to do that at: How do I use Bash on Windows from the Visual Studio Code integrated terminal?HOME
variable yourself in Powershell, using something like:$Env:Home = "c:\path\to\my\work\dir"
To be honest, I'm not 100% sure that the second option will work.
More information about the specific error you're seeing at the cargo-build-bpf
source code: https://github.com/solana-labs/solana/blob/d5dec989b93fc94c9416a60193e52e8b68bd7133/sdk/cargo-build-bpf/src/main.rs#L474
Upvotes: 5