windows 编译rustdesk

下载 rustup-init.exe 并以管理员身份运行它来安装 rust

 

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 的位置。

Sciter 

桌面版本使用 Sciter 作为 GUI,请下载 sciter.dll

LLVM 

rust-bindgen 依赖于 clang,下载 LLVM 并安装,添加系统环境变量 LIBCLANG_PATH=<llvm_install_dir>/bin

您可以在这里下载 LLVM 二进制文件的 15.0.2 版本:64 位 / 32 位

 

 python -m pip install brotli -i https://pypi.tuna.tsinghua.edu.cn/simple

 

 

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

 

python generate.py -f "E:\rustdesk\target\debug" -o "." -e "rustdesk.exe"

 

 

你贴的这个 build.py 脚本其实就是 RustDesk 官方用来做跨平台打包和构建的 Python 自动化脚本。它可以根据操作系统和参数生成 Windows portable、Linux .deb、macOS .dmg 等安装包。

从脚本来看几个重点:

  1. Windows portable 构建

    • 会先 cargo build --release 编译 RustDesk 的 Rust 核心。

    • flutter build windows --release 构建 Flutter UI。

    • 最后会调用 libs/portable/generate.py 生成 data.bin 并打包成 rustdesk_portable.exe

  2. Linux / macOS 构建

    • Linux 支持 .deb、Arch .pkg.tar.zst、Fedora .rpm

    • macOS 支持 .dmg 打包和代码签名(可选)。

  3. 第三方资源

    • external_resources 负责把某些 feature 的第三方文件下载/解压到 resources/,Flutter 也会用到。

  4. MD5 校验

    • 打包时会对关键文件生成 MD5 写入 tmpdeb/DEBIAN/md5sums

  5. 参数选项

    • --flutter:构建 Flutter UI。

    • --portable:Windows portable。

    • --skip-cargo:跳过 Rust 编译(通常只做 Flutter 构建)。

    • --hwcodec--vram--unix-file-copy-paste:启用特定功能。

    • --package:直接从已有二进制构建 Linux 包。

所以如果你的目标是生成 Windows portable 并得到 data.bin,只需要:

cd rustdesk
python3 build.py --portable

或者在 Windows 上:

python build.py --portable

前提:

  • Rust 环境可用 (cargo build --release 能成功)。

  • Python 3 + pip 依赖(libs/portable/requirements.txt)安装好。

  • Flutter SDK 可用(用于构建 UI)。

⚠️ 注意:

  • 脚本会自动调用 generate.py 生成 data.bin

  • 如果你之前尝试手动生成 data.bin 的 Rust 脚本有问题,可以直接用这个官方流程,保证和官方发布版本一致。

  • Windows portable 会生成最终的 rustdesk-<version>-install.exe

 

posted @ 2025-09-03 23:34  Fitz  阅读(190)  评论(0)    收藏  举报