Mircia George
Mircia George

Reputation: 43

How to solve cargo build-bpf not working?

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

Answers (1)

Jon C
Jon C

Reputation: 8412

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

Upvotes: 5

Related Questions