This commit is contained in:
MICHAL\mwitek 2023-02-27 20:47:29 +01:00
parent 8ae7d05372
commit 399744d69f
2 changed files with 31 additions and 20 deletions

View File

@ -7,30 +7,40 @@ weight: 22
This tutorial is based on **Linux**, and supposing you are **familiar** with [Android NDK](https://developer.android.com/ndk/downloads), [Rust](https://rustup.rs/) and [Flutter](https://flutter.dev/). If you are not, please skip.
{{% /notice %}}
## Build Rust
{{% notice note %}}
It is possible to build RustDesk Android on **Windows**
{{% /notice %}}
## Generating Bridge
Due to fact that this project is based on [Flutter Rust Bridge](https://cjycode.com/flutter_rust_bridge/index.html) you should first generate it, you can achieve it by running following commands:
- Change your current directory into `rustdesk` directory, if you did not have one, clone [RustDesk repository](https://github.com/rustdesk/rustdesk), you can achieve that by running: `git clone https://github.com/rustdesk/rustdesk`
```
cd
# For saving your time and our time, we prepared dependent files for you.
wget https://github.com/rustdesk/doc.rustdesk.com/releases/download/console/dep.tar.gz
tar xzf dep.tar.gz
# please use r22b, new NDK has below problem
# https://stackoverflow.com/questions/68873570/how-do-i-fix-ld-error-unable-to-find-library-lgcc-when-cross-compiling-rust
wget https://dl.google.com/android/repository/android-ndk-r22b-linux-x86_64.zip
unzip android-ndk-r22b-linux-x86_64.zip
# install ffigen and llvm
dart pub global activate ffigen 5.0.1
# on Ubuntu 18, it is: sudo apt install libclang-9-dev
sudo apt-get install libclang-dev
sudo apt install gcc-multilib
git clone https://github.com/rustdesk/rustdesk
cd rustdesk
rustup target add aarch64-linux-android
```
cargo install cargo-ndk
You also might be required to install some prerequisites if you are doing this first time
```
sudo apt update -y
sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang cmake libclang-dev ninja-build llvm-dev libclang-10-dev llvm-10-dev pkg-config
```
## Installing Flutter Rust Bridge dependencies
At this step you'll install additional dependencies required by [Flutter Rust Bridge](https://cjycode.com/flutter_rust_bridge/index.html) also you'll download flutter dependencies from `pubspec.yaml` file.
VCPKG_ROOT=$HOME/vcpkg ANDROID_NDK_HOME=$HOME/android-ndk-r22b flutter/ndk_arm64.sh
This might take some time depending on your internet connection speed and overall desktop performance
```
cargo install flutter_rust_bridge_codegen
pushd flutter && flutter pub get && popd
```
## Running Flutter Rust Bridge
This step will generate flutter bridge file (`generated_bridge.dart`), you'll use it later
This should take approximately 2 - 5 minutes
```
~/.cargo/bin/flutter_rust_bridge_codegen --rust-input ./src/flutter_ffi.rs --dart-output ./flutter/lib/generated_bridge.dart
```
## Build Flutter

View File

@ -5,6 +5,7 @@ weight: 30
## How to build with Docker
### This won't work on Windows
Begin by cloning the repository and building the docker container: