Files
doc.rustdesk.com/content/dev/build/windows/_index.zh-cn.md
rustdesk 56cfd26e35 seo/geo
2026-03-20 18:42:55 +08:00

72 lines
3.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Windows
weight: 20
description: "RustDesk 的Windows文档提供安装、配置、部署和故障排查指南。"
keywords: ["build rustdesk windows", "rustdesk windows build", "rustdesk vcpkg windows", "rustdesk sciter dll", "rustdesk llvm libclang"]
---
## 在 Windows 上构建前需要准备什么?
在 Windows 上构建 RustDesk 需要准备 Visual Studio C++ 工具链、Rust、`vcpkg``sciter.dll` 以及配置好 `LIBCLANG_PATH` 的 LLVM。这里的命令请在 Git Bash 中运行,这样示例命令和环境变量写法才能直接生效。
## Windows 构建检查清单
- 安装带 C++ 工作负载的 Visual Studio。
- 通过 `rustup-init.exe` 安装 Rust。
- 克隆并初始化 `vcpkg`,然后设置 `VCPKG_ROOT`
- 下载桌面 UI 所需的 `sciter.dll`
- 安装 LLVM并将 `LIBCLANG_PATH` 指向其 `bin` 目录。
- 克隆 RustDesk 并在 Git Bash 中执行默认构建步骤。
{{% notice note %}}
这里的命令行命令必须在 Git Bash 中运行,而不是命令提示符,否则您将遇到语法错误。
{{% /notice %}}
## 依赖
### C++编译环境
下载 [MSVC](https://visualstudio.microsoft.com/) 并安装。
选择 `Windows` 作为开发人员机器操作系统并勾选 `C++`,然后下载 Visual Studio Community 版本并安装。安装可能需要一段时间。
### Rust 开发环境
下载 [rustup-init.exe](https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe) 并以管理员身份运行它来安装 `rust`
### vcpkg
转到您想要克隆 vcpkg 的文件夹,并使用 [Git Bash](https://git-scm.com/download/win) 运行以下命令,下载 `vcpkg`,安装 64 位版本的 `libvpx``libyuv``opus`
如果您没有安装 `Git`,请在[这里](https://git-scm.com/download/win)获取 `Git`
```sh
git clone https://github.com/microsoft/vcpkg
vcpkg/bootstrap-vcpkg.bat
export VCPKG_ROOT=$PWD/vcpkg
vcpkg/vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static aom:x64-windows-static
```
添加系统环境变量 `VCPKG_ROOT`=`<path>\vcpkg``<path>` 应该是您在上面选择克隆 `vcpkg` 的位置。
![](/docs/en/dev/build/windows/images/env.png)
### Sciter
桌面版本使用 [Sciter](https://sciter.com/) 作为 GUI请下载 [sciter.dll](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.win/x64/sciter.dll)。
### LLVM
`rust-bindgen` 依赖于 `clang`,下载 [LLVM](https://github.com/llvm/llvm-project/releases) 并安装,添加系统环境变量 `LIBCLANG_PATH`=`<llvm_install_dir>/bin`
您可以在这里下载 LLVM 二进制文件的 15.0.2 版本:[64 位](https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.2/LLVM-15.0.2-win64.exe) / [32 位](https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.2/LLVM-15.0.2-win32.exe)。
#### 默认
```sh
git clone --recurse-submodules https://github.com/rustdesk/rustdesk
cd rustdesk
mkdir -p target/debug
wget https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.win/x64/sciter.dll
mv sciter.dll target/debug
cargo run
```