1

I try 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 on VS Code terminal I got this error: Can't get home directory path: environment variable not found. Any ideas about how to solve it? I don't know how many details are needed for understanding the problem (I m new with Rust), but I can add more if you ask.

1 Answers1

4

cargo build-bpf requires the HOME environment variable to be set to work. To resolve this, you have a few options:

$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

Jon C
  • 4,544
  • 3
  • 11