This document describes how RustDesk manages dependencies across its multi-platform, multi-language codebase. RustDesk uses three primary dependency management systems: Cargo for Rust dependencies, Pub for Flutter/Dart dependencies, and vcpkg for C/C++ native libraries. This page covers dependency declaration, version pinning, platform-specific requirements, and how dependencies are resolved during builds.
For information about the build orchestration and compilation process, see Build Configuration. For CI/CD pipeline details, see CI/CD Pipelines.
RustDesk's dependency management is split across three ecosystems, each managing a different layer of the application stack:
Dependency Management Architecture
Sources: Cargo.toml1-235 flutter/pubspec.yaml1-201 .github/workflows/flutter-build.yml33-43
Dependency System Summary
| System | Purpose | Manifest Files | Lock Files | Package Count |
|---|---|---|---|---|
| Cargo | Rust core logic, native bindings | Cargo.toml | Cargo.lock | ~500 packages |
| Pub | Flutter UI, cross-platform widgets | pubspec.yaml | pubspec.lock | ~100 packages |
| vcpkg | C/C++ codecs (VP8/VP9/AV1, FFmpeg) | vcpkg.json | N/A (embedded in vcpkg) | ~10 libraries |
| OS Package Managers | System libraries (GTK, ALSA, PAM) | Platform-specific specs | N/A | Varies by platform |
Sources: Cargo.toml1-235 flutter/pubspec.yaml1-201 .github/workflows/flutter-build.yml142-164
The root Cargo.toml defines all Rust dependencies for the main application and workspace members. RustDesk uses a workspace structure with multiple sub-crates:
Sources: Cargo.toml198-200
Core Dependencies by Function
Sources: Cargo.toml47-86
Cargo.toml23-43 declares the feature flags that control which optional subsystems are compiled into the binary. The build.py build script (see page 7.1) translates its CLI arguments such as --flutter, --hwcodec, and --vram into --features arguments passed to cargo build.
| Feature | Dependencies Enabled | Purpose |
|---|---|---|
flutter | flutter_rust_bridge | Flutter FFI bindings; required for all Flutter UI builds |
hwcodec | scrap/hwcodec | Hardware video codec support (GPU encode/decode) |
vram | scrap/vram | VRAM-based GPU texture pipeline for video rendering |
mediacodec | scrap/mediacodec | Android MediaCodec hardware encoder/decoder |
screencapturekit | cpal/screencapturekit | macOS ScreenCaptureKit audio capture backend |
inline | (none) | Embeds Sciter HTML/CSS/JS resources directly into the binary |
linux-pkg-config | magnum-opus/linux-pkg-config, scrap/linux-pkg-config | Use system pkg-config for opus/scrap on Linux instead of bundled copies |
unix-file-copy-paste | x11-clipboard, x11rb, percent-encoding, once_cell, clipboard/unix-file-copy-paste | X11 file clipboard on Linux (copy/paste files, not just text) |
use_dasp | dasp | Default audio resampling via the dasp signal processing crate |
use_rubato | rubato | Alternative audio resampling |
use_samplerate | samplerate | Alternative audio resampling via libsamplerate |
plugin_framework | (none) | Enables the dynamic plugin loading infrastructure |
The default feature set is ["use_dasp"]. Typical CI build feature combinations:
| Build Target | Feature Flags |
|---|---|
| Windows/Linux/macOS Flutter | flutter, hwcodec, vram |
| macOS ARM64 (with ScreenCaptureKit) | flutter, hwcodec, vram, screencapturekit |
| iOS | flutter, hwcodec |
| Android | flutter, hwcodec, mediacodec |
| Windows Sciter (32-bit fallback) | inline, vram, hwcodec |
Sources: Cargo.toml23-43 .github/workflows/flutter-build.yml169 .github/workflows/flutter-build.yml366 .github/workflows/flutter-build.yml522
Network and Communication Dependencies
Cargo.toml59-86 defines networking dependencies:
parity-tokio-ipc: IPC communication via domain sockets/named pipesreqwest: HTTP client with blocking, SOCKS proxy, JSON, native-TLS, rustls-TLS, and gzip supportkcp-sys: KCP protocol for reliable UDP communicationstunclient: STUN client for NAT traversalMedia Processing Dependencies
Cargo.toml49-63 defines media dependencies:
scrap: Custom screen capture library (path dependency)magnum-opus: Opus audio codec (custom fork)dasp, rubato, samplerate: Audio resampling libraries (optional features)repng: PNG image encodingPlatform-Specific Dependencies
Cargo.toml88-196 defines platform-conditional dependencies:
Linux-only dependencies (Cargo.toml170-189):
psimple, pulse: PulseAudio bindings
evdev: Input device handling
dbus, dbus-crossroads: D-Bus integration
pam: PAM authentication
gtk: GTK3 UI toolkit
x11-clipboard, x11rb: X11 clipboard access (optional feature)
Windows-only dependencies (Cargo.toml108-138):
winapi: Windows API bindings
windows: Modern Windows API bindings
windows-service: Windows service management
virtual_display: Virtual display driver
remote_printer: Virtual printer driver
macOS-only dependencies (Cargo.toml140-152):
objc, cocoa: Objective-C and Cocoa bindings
core-foundation, core-graphics: macOS frameworks
fruitbasket: macOS app bundling
piet, piet-coregraphics: 2D graphics
Sources: Cargo.toml88-196
Rust Version Constraints
Cargo.toml9 sets the minimum Rust version:
.github/workflows/flutter-build.yml21-23 defines Rust versions used in CI:
The codebase uses Rust 1.75 for most platforms, but 1.81 for macOS due to cidre requirements.
Git Dependencies
Several dependencies use git sources with pinned commits to ensure reproducibility:
Cargo.toml59-103 shows git-sourced dependencies:
parity-tokio-ipc: Custom fork from rustdesk-orgmagnum-opus: Custom fork from rustdesk-orgrdev: Custom fork from rustdesk-orgkcp-sys: Custom fork from rustdesk-orgarboard: Custom fork from rustdesk-org with wayland-data-control featureclipboard-master: Custom fork from rustdesk-orgportable-pty: Custom branch based on wezterm 0.8.1Sources: Cargo.toml59-103 .github/workflows/flutter-build.yml21-23
Crate Source Patches
Cargo.toml210-213 patches one crate at the workspace level using [patch.crates-io]:
This replaces the published libxdo-sys crate with a local stub at libs/libxdo-sys-stub. The stub provides no-op implementations so the project builds and runs on systems that do not have libxdo installed — for example, Wayland-only desktops. Any crate in the workspace that lists libxdo-sys as a dependency receives the stub automatically without requiring a code change in that crate.
Sources: Cargo.toml210-213
Cargo.lock pins exact dependency versions for reproducible builds. Cargo.lock1-3 shows:
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
The lock file contains 500+ package entries with exact version pins. Example format from Cargo.lock5-13:
Sources: Cargo.lock1-100
flutter/pubspec.yaml1-22 defines the Flutter package:
The package requires Dart SDK 3.1.0 or higher and uses version 1.4.5 with build number 63.
Flutter Dependencies by Function
Sources: flutter/pubspec.yaml24-112
FFI and Bridge Dependencies
flutter/pubspec.yaml30-53 defines FFI-related packages:
ffi: ^2.1.0: Dart FFI for C interopflutter_rust_bridge: "1.80.1": Code generation for Rust-Dart FFI (exact version pinned)texture_rgba_renderer: Custom plugin for RGBA texture rendering (git source)flutter_gpu_texture_renderer: GPU-accelerated texture rendering (git source)Window Management Dependencies
flutter/pubspec.yaml54-66 defines multi-window capabilities:
window_manager: Custom fork for window manipulationdesktop_multi_window: Custom fork for multiple window supportwindow_size: Google's Flutter desktop plugin for window sizingAll window management packages use git sources to pull custom modifications.
State Management Dependencies
flutter/pubspec.yaml33-67 shows state management approach:
provider: ^6.0.5: ChangeNotifier-based state managementget: ^4.6.5: GetX framework for reactive state and navigationvisibility_detector: ^0.4.0+2: Widget visibility detectionChat and Messaging Dependencies
flutter/pubspec.yaml41-43 uses custom fork:
dash_chat_2: Chat UI components from rustdesk-org forkSources: flutter/pubspec.yaml24-112
Flutter SDK Version
.github/workflows/flutter-build.yml28-31 defines Flutter versions:
Flutter 3.24.5 is used for most platforms, with Flutter eLinux 3.16.9 used for ARM64 Linux builds where the official Dart SDK is unavailable.
Dependency Overrides
flutter/pubspec.yaml123-125 forces specific versions:
These overrides ensure compatibility across transitive dependencies.
Sources: flutter/pubspec.yaml123-125 .github/workflows/flutter-build.yml28-31
flutter/pubspec.lock1-3 shows:
The lock file contains exact version pins for ~100+ Flutter packages. Example entry from flutter/pubspec.lock65-72:
Sources: flutter/pubspec.lock1-100
RustDesk uses Microsoft's vcpkg for managing C/C++ dependencies, particularly multimedia codecs and libraries that require native compilation.
vcpkg Build Flow
Sources: .github/workflows/flutter-build.yml33-43 .github/workflows/flutter-build.yml142-164
vcpkg Commit Pinning
.github/workflows/flutter-build.yml34-41 defines vcpkg versions:
Two vcpkg commits are defined:
GitHub Actions Binary Cache
.github/workflows/flutter-build.yml33 enables binary caching:
This uses GitHub Actions cache to avoid rebuilding vcpkg packages on every CI run.
Sources: .github/workflows/flutter-build.yml33-43
Windows Installation
.github/workflows/flutter-build.yml146-164 shows Windows vcpkg installation:
The installation uses platform-specific triplets (e.g., x64-windows-static, x86-windows-static).
macOS Installation
.github/workflows/flutter-build.yml687-698 shows macOS vcpkg installation:
macOS uses triplets like x64-osx and arm64-osx.
Sources: .github/workflows/flutter-build.yml146-164 .github/workflows/flutter-build.yml687-698
vcpkg.json2-85 declares all C/C++ dependencies. Most libraries are listed twice with "host": true and "host": false so vcpkg builds them for both the host toolchain (used during compilation) and the target architecture (linked into the final binary), which is needed for cross-compilation.
| Library | Overlay Version | Purpose | Platform |
|---|---|---|---|
libvpx | 1.15.2 (overlay) | VP8/VP9 video codec | All platforms |
libyuv | — | YUV format conversion | All platforms |
opus | 1.5.2 (overlay) | Audio codec | All platforms |
aom | 3.12.1 (overlay) | AV1 video codec | All platforms |
libjpeg-turbo | — | JPEG encoding/decoding | All platforms |
ffmpeg | — | Media container handling with hardware codec support | Windows, Linux (non-ARM32), macOS (static); ARM mobile (static) |
mfx-dispatch | — | Intel Media SDK dispatcher | x86/x64 on Android/Linux, Windows (non-UWP) |
cpu-features | — | Runtime CPU feature detection | Android only |
oboe | — | Android audio I/O | Android only |
The ffmpeg port enables conditional hardware acceleration features based on the target platform:
amf — AMD Advanced Media Framework (Windows and Linux, static builds)nvcodec — NVIDIA NVENC/NVDEC (Windows and Linux, static builds)qsv — Intel Quick Sync Video (Windows, static only)Custom Overlay Ports
vcpkg.json91-93 registers ./res/vcpkg as a local overlay port directory. Three upstream vcpkg ports are overridden here to control exact versions and apply project-specific patches:
| Port | Manifest | Purpose of Override |
|---|---|---|
libvpx | res/vcpkg/libvpx/vcpkg.json1-26 | Pins to 1.15.2; patches for UWP support and library suffix removal |
opus | res/vcpkg/opus/vcpkg.json1-22 | Pins to 1.5.2; patches pkg-config version detection |
aom | res/vcpkg/aom/vcpkg.json1-18 | Pins to 3.12.1; patches for build compatibility |
Version Overrides
vcpkg.json95-104 pins versions of transitive dependencies that the above ports pull in:
ffnvcodec → 12.1.14.0amd-amf → 1.4.35Baseline Synchronization
The default-registry baseline in vcpkg.json87-90 must match VCPKG_COMMIT_ID in .github/workflows/flutter-build.yml40 A comment in the workflow explains the requirement: when VCPKG_COMMIT_ID is changed, $VCPKG_ROOT/vcpkg x-update-baseline must be run to regenerate the baseline entry in vcpkg.json; mismatches between the two will cause build failures.
These libraries are compiled from source by vcpkg with platform-specific optimizations.
Sources: vcpkg.json1-105 res/vcpkg/libvpx/vcpkg.json1-26 res/vcpkg/opus/vcpkg.json1-22 res/vcpkg/aom/vcpkg.json1-18 .github/workflows/flutter-build.yml33-43 .github/workflows/flutter-build.yml146-164
APT Package Requirements
Linux builds require system packages installed via APT. AppImage configurations define these dependencies:
appimage/AppImageBuilder-x86_64.yml39-65 lists required packages for x86_64 Linux:
appimage/AppImageBuilder-aarch64.yml39-65 defines similar dependencies for ARM64 Linux, using arm64 architecture sources from Ubuntu Ports.
RPM Package Requirements
res/rpm-flutter.spec8-10 defines RPM dependencies for Fedora/RHEL:
res/rpm-flutter-suse.spec8-10 defines similar dependencies for openSUSE with slightly different package names:
Arch Linux Dependencies
res/PKGBUILD10 lists Arch Linux dependencies:
depends=('gtk3' 'xdotool' 'libxcb' 'libxfixes' 'alsa-lib' 'libva' 'libappindicator-gtk3' 'pam' 'gst-plugins-base' 'gst-plugin-pipewire')
Sources: appimage/AppImageBuilder-x86_64.yml39-65 res/rpm-flutter.spec8-9 res/PKGBUILD10
System DLL Requirements
Windows builds rely on system DLLs that are typically present on Windows installations. The build process does not explicitly list these, but they include:
Build-time Dependencies
.github/workflows/flutter-build.yml101-104 installs LLVM:
where LLVM_VERSION is set to "15.0.6" in .github/workflows/flutter-build.yml27
Sources: .github/workflows/flutter-build.yml101-104 .github/workflows/flutter-build.yml27
Homebrew Build Dependencies
.github/workflows/flutter-build.yml624-632 installs build runtime:
NASM Installation
.github/workflows/flutter-build.yml634-643 installs NASM 2.16:
NASM 2.16.x is explicitly used instead of 3.x because NASM 3.x has incompatible CLI options and removed features required by aom and multimedia libraries.
Sources: .github/workflows/flutter-build.yml624-643
NDK Requirements
.github/workflows/flutter-build.yml43 sets NDK version:
.github/workflows/flutter-build.yml24 sets cargo-ndk version:
Android Build Dependencies
Android builds require:
cargo-ndk 3.1.2 for building Rust code for Android targetsSources: .github/workflows/flutter-build.yml24 .github/workflows/flutter-build.yml43
GitHub Actions Cache Strategy
The workflow configures three levels of caching to optimize build times:
Cache Environment Setup
.github/workflows/flutter-build.yml83-88 exports GitHub Actions cache environment variables:
These environment variables enable the cache backends used by Rust and vcpkg.
Rust Dependency Cache
.github/workflows/flutter-build.yml135-137 uses Swatinem/rust-cache@v2:
This caches:
~/.cargo/registry/index/ - Registry index~/.cargo/registry/cache/ - Downloaded crate tarballs~/.cargo/git/db/ - Git dependenciestarget/ - Compiled artifactsThe prefix-key ensures separate caches per operating system. For example, .github/workflows/flutter-build.yml329-331 uses prefix-key: ${{ matrix.job.os }}-sciter for Sciter builds.
vcpkg Binary Cache
.github/workflows/flutter-build.yml33 enables GitHub Actions binary caching for vcpkg:
.github/workflows/flutter-build.yml139-144 configures vcpkg with caching:
The x-gha,readwrite source tells vcpkg to read and write prebuilt binaries to GitHub Actions cache, avoiding repeated compilation of libraries like FFmpeg.
Flutter SDK Cache
.github/workflows/flutter-build.yml107-110 enables Flutter SDK caching:
The subosito/[email protected] action automatically caches the Flutter SDK across builds.
Sources: .github/workflows/flutter-build.yml33 .github/workflows/flutter-build.yml83-144 .github/workflows/flutter-build.yml329-331
Dependency Resolution Flow
The following diagram shows the precise build steps and their dependencies, referencing actual workflow step names:
Sources: .github/workflows/flutter-build.yml51-282 .github/workflows/bridge.yml1-99
Platform-Conditional Steps
The CI workflow uses matrix builds with platform-specific configurations. Example for Windows from .github/workflows/flutter-build.yml65-81:
And for macOS from .github/workflows/flutter-build.yml559-577:
Each job uses different vcpkg triplets and target architectures.
Sources: .github/workflows/flutter-build.yml65-81 .github/workflows/flutter-build.yml559-577
Lock File Updates
Lock files (Cargo.lock, pubspec.lock) are committed to version control to ensure reproducible builds. Updates are performed manually:
cargo update to update within version constraintsflutter pub upgrade to update within version constraintsVCPKG_COMMIT_ID to a newer commitVersion Constraint Updates
To update major versions, manifest files must be edited:
Sources: Cargo.toml47-86 flutter/pubspec.yaml24-112 .github/workflows/flutter-build.yml40
Refresh this wiki
This wiki was recently refreshed. Please wait 2 days to refresh again.