docs: 修正 cargo 网络配置建议(代理而非镜像源)+ 更新构建命令路径

- 实测 USTC 镜像索引 cksum 与下发的 .crate 字节不一致(nvenc 0.1.0),
  源替换会触发 checksum 校验失败并改变 registry 身份;改为 [http] proxy 走官方源
- 构建命令里 D:\\wordkb\\... 的失效路径替换为可用写法
- 已实测:Windows cargo build --release 通过(agent.exe/viewer.exe/encbench.exe)
  且 cargo test -p linux-agent 在容器内 2 passed
This commit is contained in:
yu 2026-10-23 14:10:20 +08:00
parent 9fda49d9c9
commit 49f85db9f9

View File

@ -20,31 +20,34 @@
- `rustup default stable-x86_64-pc-windows-gnu`,装到 `%USERPROFILE%\.cargo\bin`
- MinGW-w64:`D:\mingw64\bin`(gcc 16.2.0)
- 构建时 PATH 需同时包含上面两个目录(缺 MinGW 会在链接 openh264 的 C++ 时失败)
- **cargo 源**:国内直连 crates.io 会超时(cargo 不读系统代理),需配置镜像。已在本机
`%USERPROFILE%\.cargo\config.toml` 写入 USTC 源:
- **cargo 网络**:国内直连 crates.io 会超时,且 **cargo 不读 Windows 系统代理**,必须显式告诉它。
已在本机 `%USERPROFILE%\.cargo\config.toml` 写入(Clash 之类混合端口,按实际改):
```toml
[source.crates-io]
replace-with = "ustc"
[source.ustc]
registry = "sparse+https://mirrors.ustc.edu.cn/crates.io-index/"
[http]
proxy = "http://127.0.0.1:7897"
```
⚠️ **不要用国内镜像做源替换**:实测 USTC 镜像的索引 `cksum` 与其实际下发的 `.crate`
字节**不一致**(`nvenc 0.1.0`:索引写 `3227c3b0…`,包体实际 `ab6fde0e…`),
会报 `failed to verify the checksum of nvenc`;且源替换会改变 registry 身份,
使 `Cargo.lock` 里已有的 checksum 与全部缓存失配。**走官方源 + 代理最稳。**
> 注:旧版本手册写的 `D:\wordkb\...\uurev\tools\rust` 路径已不存在,按上面重新准备工具链即可。
## 3. 构建
```bash
export RUSTUP_HOME="D:\\wordkb\\2026-10-22-15-52-47\\uurev\\tools\\rust\\rustup"
export CARGO_HOME="D:\\wordkb\\2026-10-22-15-52-47\\uurev\\tools\\rust\\cargo"
export PATH="/d/wordkb/2026-10-22-15-52-47/uurev/tools/rust/cargo/bin:/d/wordkb/2026-10-22-15-52-47/uurev/tools/mingw64/bin:$PATH"
cd /d/wordkb/2026-10-22-15-52-47/mvp-remote
# Git Bash 写法:PATH 需含 rustup 的 cargo 与 MinGW-w64
export PATH="$USERPROFILE/.cargo/bin:/d/mingw64/bin:$PATH"
cd /d/code/remote # 换成你自己的工作目录 / worktree
cargo build --release
```
产物:
- 被控端 `target/release/agent.exe`
- 主控端 `target/release/viewer.exe`
- 编码基准(可选)`target/release/encbench.exe`
## 4. 运行(两台机器,或同机双开验证)