【问题标题】:Command line errors while using cargo build使用 cargo build 时出现命令行错误
【发布时间】:2022-04-12 10:23:26
【问题描述】:

我正在尝试在 Windows 上启动 Solana 项目。当我在 cmd 中运行 cargo build 时,它工作正常;但是对于cargo build-bpf,我得到一个错误:

BPF SDK: \\?\C:\Users\HP\.local\share\solana\install\releases\1.9.4\solana-release\bin\sdk\bpf
Can't get home directory path: environment variable not found

我尝试安装 WSL,但是当我运行 cargo buildcargo build-bpf 时,我收到此错误:

error: `rustc -vV` didn't have a line for `host:`, got:

我该如何解决这个问题?

【问题讨论】:

    标签: rust rust-cargo solana solana-cli


    【解决方案1】:

    您可能使用的是不提供主机三元组的旧版 Rust,因此请确保您使用的是 wsl 中最新的稳定版。更多信息How can I query rustc for the host triple?

    在进入 WSL 之前,您还可以尝试从支持 Bash 的 shell 运行 cargo build-bpf,例如 Windows 上的 Git Bash:https://gitforwindows.org/

    【讨论】:

    • 是的,我必须升级到 wsl2,这修复了错误:rustc -vV 没有host: 的行,得到:,
    • 知道如何解决在 WSL1 上保留(单一)WSL 的问题吗?
    猜你喜欢
    • 2020-05-03
    • 2022-08-03
    • 2019-09-12
    • 1970-01-01
    • 1970-01-01
    • 2014-03-19
    • 1970-01-01
    • 2020-01-09
    • 2021-01-08
    相关资源
    最近更新 更多