How to build rustdesk windows flutter version - huapage/rustdesk GitHub Wiki
The document in https://rustdesk.com/docs/en/dev/build/windows/ is for sciter version. For Flutter version, can refer to the nightly build log. ( Can download from https://github.com/rustdesk/rustdesk/actions ).
Sample log: logs_34201099513.zip
Current RustDesk version is 1.3.7
- git clone https://github.com/rustdesk/rustdesk.git --branch 1.3.7 --single-branch --recursive
rust and vcpkg installation is similar to the sciter version one, but need to specify the exact version.
- rust version can use 1.75.0. Refer to How-to-install-rustc-1.75.0
From the build log, LLVM version is 15.0.6 ( Rust 1.3.2 and 1.3.7 both use LLVM 15.0.6 )
https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/LLVM-15.0.6-win64.exe
Install to default folder is better. Some tool will check the default install location.
- vcpkg install need to run in RustDesk source code root folder, since there is a vcpkg.json file to define the versions of different modules.
env setting:
VCPKG_DEFAULT_BINARY_CACHE=C:\vcpkg_cache
VCPKG_DEFAULT_HOST_TRIPLET=x64-windows-static
( Needed )
VCPKG_ROOT=C:\vcpkg
( Needed )
RUNVCPKG_VCPKG_ROOT_OUT=C:\vcpkg
( Not sure if needed )
VCPKG_INSTALLED_DIR=c:\vcpkg\installed
(Not sure if needed )
Add C:\vcpkg to path.
command line (Can run in Git Bash):
vcpkg install --recurse --clean-after-build --x-install-root c:\vcpkg\installed --triplet x64-windows-static
(get from build log of GitHub )
Original log:
runVcpkgFormatString: [install
, --recurse
, --clean-after-build
, --x-install-root
, $[env.VCPKG_INSTALLED_DIR]
, --triplet
, $[env.VCPKG_DEFAULT_TRIPLET]
]
The --x-install-root possible not needed, the default one is c:\vcpkg\installed
https://github.com/microsoft/vcpkg.git
commit hash: 6f29f12e82a8293156836ad81cc9bf5af41fe836 ( tag 2025.01.13, for RustDesk 1.3.7 )
commit hash: 1de2026f28ead93ff1773e6e680387643e914ea1 ( tag 2024.07.12, for RustDesk 1.3.2 )
- Need to generate bridge
(The command line comes from 4_run-flutter-nightly-build _ generate-bridge _ generate_bridge (x86_64-unknown-linux-gnu, ubuntu-20.04).txt gitbhub build log )
cargo install flutter_rust_bridge_codegen --version 1.80.1 --features "uuid" --locked
%USERPROFILE%\.cargo\bin\flutter_rust_bridge_codegen --rust-input .\src\flutter_ffi.rs --dart-output .\flutter\lib\generated_bridge.dart --c-output .\src\bridge_generated.h
This part need LLVM was already installed.
Assume you are building RustDesk 1.3.2
(
Need to specify FLUTTER_ROOT=C:\Users\user\fvm\versions\3.19.6
Need to add flutter.bat to path C:\Users\user\fvm\versions\3.19.6\bin;%path%
Can use fvm to install flutter
https://github.com/leoafarias/fvm/releases/download/3.2.0/fvm-3.2.0-windows-x64.zip
fvm install 3.19.6 --setup
)
If you are building RustDesk 1.3.7
fvm install 3.24.5 --setup
FLUTTER_ROOT=C:\hostedtoolcache\windows\flutter\stable-3.24.5-x64
or
C:\Users\user\fvm\versions\3.24.5
Also add path
C:\Users\user\fvm\versions\3.24.5\bin
If generate failed can try the following commands in rustdesk\flutter folder.
call flutter pub upgrade
call flutter clean
call flutter pub cache clean
call flutter pub get
A flutter\.dart_tool folder will be created.
The following files will be generated:
(
src\bridge_generated.rs
src\bridge_generated.io.rs
flutter\lib\generated_bridge.dart
flutter\lib\generated_bridge.freezed.dart
)
- Can use the following command to build:
python3 ./build.py --portable --hwcodec --flutter --vram --skip-portable-pack
( When run in Git Bash )
or
python3 build.py --portable --hwcodec --flutter --vram --skip-portable-pack
( When run in windows command line )
( in windows can copy python.exe to python3.exe if you already installed python3 )
-
Can use the following command to run: start flutter\build\windows\x64\runner\Release\rustdesk.exe
-
If you want to build debug version, you can copy build.py to build_debug.py, remove the --release in cargo command line ( by default cargo will build debug version ) and adjust some folder names.\
A sample build_debug.py: build_debug.py.txt
- To build a portable executable
(1) pip3 should be in path ( e.g. Add "C:\Python312\Scripts" to path if pip3 is in "C:\Python312\Scripts\pip3.exe" )
(2) from "{sanbox_root}.github\workflows\third-party-RustDeskTempTopMostWindow.yml" git clone https://github.com/rustdesk-org/RustDeskTempTopMostWindow RustDeskTempTopMostWindow Build with visual studio 2002, x64 release build, can get a DLL. ( Or run the official release, get the DLL from %localappdata%\rustdesk ) RustDeskTempTopMostWindow\x64\Release\WindowInjection.dll
(3) Put the DLL to {sanbox_root}\flutter\build\windows\x64\runner\Release\
(4) Can also get usbmmidd_v2 folder from official release, and put to {sanbox_root}\flutter\build\windows\x64\runner\Release\
(5) Run "{sanbox_root}\python3 ./build.py --portable --hwcodec --flutter --vram"
(6) {sandbox_root}\target\release\deps\rustdesk_portable_packer.exe will be generated An installer will also be generated rustdesk-x.y.z-install.exe ( x.y.z is the version ).
For flutter, some files are stored in: %localappdata%\Pub\Cache If you need to build RustDesk 1.3.2 and 1.3.7 in the same machine, since they use different flutter version, the Pub folder is also different.
In environment variable, need to set FLUTTER_ROOT to different folder. e.g. 1.3.7 can be C:\hostedtoolcache\windows\flutter\stable-3.24.5-x64.
1.3.2 can be C:\Users[your_user_name]\fvm\versions\3.19.6 ( %USERPROFILE%\fvm\versions\3.19.6 ).
Can use fvm install more versions of flutter.
Need to add flutter.bat to path, e.g. C:\Users\user\fvm\versions\3.19.6\bin .
Document related to fvm:
https://fvm.app/documentation/getting-started/installation
https://github.com/leoafarias/fvm/releases/download/3.2.0/fvm-3.2.0-windows-x64.zip
https://fvm.app/documentation/guides/basic-commands
fvm list
fvm install [version]
e.g.
fvm install 3.19.6
fvm install 3.24.5 --setup