ARMhf

このチュートリアルは@wwjabcによって提供されました

https://github.com/rustdesk/rustdesk/issues/175#issuecomment-1129516367

基本的なビルド手順

  • ubuntu18.04_rootfs.tar.gzをダウンロード(抽出コード:xlnx)。私はいくつかのバージョンのUbuntuシステムを試しましたが、これでのみ成功しました。コンパイルされた実行可能ファイルは他のarmhfシステムで使用できます。PS:システムソースを信頼しない場合は、このチュートリアルに基づいてシステムでコンパイルすることもできます。成功した場合は、このチュートリアルを置き換えるソリューションを提出してください。

  • PYNQ公式リソース | PYNQ-github | ubuntu

  • cmake-3.14.5をダウンロードしてコンパイル。コンパイル参考チュートリアル。システムの組み込みcmakeバージョンは3.10.2で、vcpkg-2020.11のコンパイル時にバージョンが低すぎるというエラーが発生します

    • ボード上でコンパイル(qemu仮想マシンのセットアップに成功しませんでした)
  • vcpkgをインストールし、VCPKG_ROOT環境変数を正しく設定します。vcpkg-2020.11のダウンロードを推奨します。これは私が現在使用しているバージョンです

    • Linux: vcpkg install libyuv
    • libvpx(抽出コード:xlnx)(手動インストール、なぜこのファイルを指定するかというと、このファイルに基づいてコンパイルに成功したことを表現したいからです。他のファイルをダウンロードしてこのファイルを置き換えることもできます。)
    • opus(抽出コード:xlnx)(手動インストール、上記と同じ理由。)
  • cargo build --releaseでコンパイル

armhfでのコンパイル

SDカードにUbuntu 18.04をインストール

sudo tar zxmf ./ubuntu18.04_rootfs.tar.gz -C /your sd path/rootfs/
#ユーザー名:xilinx
#パスワード:xilinx

cmakeをインストール

tar -xzvf cmake-3.14.5.tar.gz
cd cmake-3.14.5/
#これらの2つのステップは非常に長い時間がかかる可能性があります。順番に入力してください
./bootstrap
make -j4
sudo make install
root@pynq:~/cmake-3.14.5# ./bootstrap 
---------------------------------------------
CMake 3.14.5, Copyright 2000-2019 Kitware, Inc. and Contributors
Found GNU toolchain
C compiler on this system is: gcc       
C++ compiler on this system is: g++          
Makefile processor on this system is: make
g++ has setenv
g++ has unsetenv
g++ does not have environ in stdlib.h
g++ has stl wstring
g++ has <ext/stdio_filebuf.h>
---------------------------------------------
root@pynq:~/cmake-3.14.5# cmake --version
cmake version 3.14.5

CMake suite maintained and supported by Kitware (kitware.com/cmake).

依存関係をインストール

sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev ninja-build

vcpkgをインストール

tar zxmf vcpkg-2020.11.tar.gz
mv vcpkg-2020.11 vcpkg
vcpkg/bootstrap-vcpkg.sh
export VCPKG_ROOT=$HOME/vcpkg
export VCPKG_FORCE_SYSTEM_BINARIES=1
vcpkg/vcpkg install libyuv
root@pynq:~# export VCPKG_ROOT=$HOME/vcpkg
root@pynq:~# export VCPKG_FORCE_SYSTEM_BINARIES=1
root@pynq:~# vcpkg/vcpkg install libyuv
Computing installation plan...
The following packages will be built and installed:
  * libjpeg-turbo[core]:arm-linux
    libyuv[core]:arm-linux
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet arm-linux...
Starting package 1/2: libjpeg-turbo:arm-linux
Building package libjpeg-turbo[core]:arm-linux...
Could not locate cached archive: /root/.cache/vcpkg/archives/62/629c73ee8920588cb446128f15cbfa66dfec1528.zip
-- Using community triplet arm-linux. This triplet configuration is not guaranteed to succeed.
-- [COMMUNITY] Loading triplet configuration from: /root/vcpkg/triplets/community/arm-linux.cmake
-- Downloading https://github.com/libjpeg-turbo/libjpeg-turbo/archive/ae87a958613b69628b92088b313ded0d4f59a716.tar.gz...
-- Extracting source /root/vcpkg/downloads/libjpeg-turbo-libjpeg-turbo-ae87a958613b69628b92088b313ded0d4f59a716.tar.gz
-- Applying patch add-options-for-exes-docs-headers.patch
-- Applying patch workaround_cmake_system_processor.patch
-- Using source at /root/vcpkg/buildtrees/libjpeg-turbo/src/0d4f59a716-5f2e7bc00b.clean
-- Configuring arm-linux-dbg
-- Configuring arm-linux-rel
-- Building arm-linux-dbg
-- Building arm-linux-rel
-- Performing post-build validation
-- Performing post-build validation done
Stored binary cache: /root/.cache/vcpkg/archives/62/629c73ee8920588cb446128f15cbfa66dfec1528.zip
Building package libjpeg-turbo[core]:arm-linux... done
Installing package libjpeg-turbo[core]:arm-linux...
Installing package libjpeg-turbo[core]:arm-linux... done
Elapsed time for package libjpeg-turbo:arm-linux: 5.475 min
Starting package 2/2: libyuv:arm-linux
Building package libyuv[core]:arm-linux...
Could not locate cached archive: /root/.cache/vcpkg/archives/36/3683c357e53932d95a037b4eb8cb74fe71c15f80.zip
-- Using community triplet arm-linux. This triplet configuration is not guaranteed to succeed.
-- [COMMUNITY] Loading triplet configuration from: /root/vcpkg/triplets/community/arm-linux.cmake
-- Fetching https://chromium.googlesource.com/libyuv/libyuv...
#ここで長時間ハングアップすることがあり、失敗することもあります。ctrl+cを押してvcpkg/vcpkg install libyuvを再実行できます
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:106 (message):
    Command failed: /usr/bin/git fetch https://chromium.googlesource.com/libyuv/libyuv fec9121b676eccd9acea2460aec7d6ae219701b9 --depth 1 -n
    Working Directory: /root/vcpkg/downloads/git-tmp
    Error code: 128
    See logs for more information:
      /root/vcpkg/buildtrees/libyuv/git-fetch-arm-linux-err.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_from_git.cmake:78 (vcpkg_execute_required_process)
  ports/libyuv/portfile.cmake:3 (vcpkg_from_git)
  scripts/ports.cmake:135 (include)


Error: Building package libyuv:arm-linux failed with: BUILD_FAILED
Please ensure you are using the latest portfiles with `./vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
  Package: libyuv:arm-linux
  Vcpkg version: 2020.06.15-unknownhash

Additionally, attach any relevant sections from the log files above.
  • またはオフラインパッケージlibyuv(抽出コード:xlnx)を直接ダウンロードしてvcpkg/downloads/フォルダにコピー(このオプションはオプションで、ネットワーク状態が悪い場合に使用できます)、その後続行
mv ./libyuv-fec9121b676eccd9acea2460aec7d6ae219701b9.tar.gz vcpkg/downloads/
vcpkg/vcpkg install libyuv
root@pynq:~# mv libyuv-fec9121b676eccd9acea2460aec7d6ae219701b9.tar.gz vcpkg/downloads/
root@pynq:~# vcpkg/vcpkg install libyuv
Computing installation plan...
The following packages will be built and installed:
    libyuv[core]:arm-linux
Detecting compiler hash for triplet arm-linux...
Starting package 1/1: libyuv:arm-linux
Building package libyuv[core]:arm-linux...
Could not locate cached archive: /root/.cache/vcpkg/archives/36/3683c357e53932d95a037b4eb8cb74fe71c15f80.zip
-- Using community triplet arm-linux. This triplet configuration is not guaranteed to succeed.
-- [COMMUNITY] Loading triplet configuration from: /root/vcpkg/triplets/community/arm-linux.cmake
-- Using cached /root/vcpkg/downloads/libyuv-fec9121b676eccd9acea2460aec7d6ae219701b9.tar.gz
-- Extracting source /root/vcpkg/downloads/libyuv-fec9121b676eccd9acea2460aec7d6ae219701b9.tar.gz
-- Applying patch fix_cmakelists.patch
-- Applying patch fix-build-type.patch
-- Using source at /root/vcpkg/buildtrees/libyuv/src/ae219701b9-6b491b90af.clean
-- Configuring arm-linux-dbg
-- Configuring arm-linux-rel
-- Building arm-linux-dbg
-- Building arm-linux-rel
-- Installing: /root/vcpkg/packages/libyuv_arm-linux/share/libyuv/copyright
-- Performing post-build validation
-- Performing post-build validation done
Stored binary cache: /root/.cache/vcpkg/archives/36/3683c357e53932d95a037b4eb8cb74fe71c15f80.zip
Building package libyuv[core]:arm-linux... done
Installing package libyuv[core]:arm-linux...
Installing package libyuv[core]:arm-linux... done
Elapsed time for package libyuv:arm-linux: 2.266 min

Total elapsed time: 2.59 min

The package libyuv:arm-linux provides CMake targets:

    find_package(libyuv CONFIG REQUIRED)
    target_link_libraries(main PRIVATE yuv)

libvpxをインストール

mv webmproject-libvpx-v1.9.0.tar.gz vcpkg/downloads/
cd vcpkg/downloads/
tar zxmf webmproject-libvpx-v1.9.0.tar.gz
cd libvpx-1.9.0
#prefixは自分のvcpkgパスに応じて設定する必要があります
./configure --prefix="/root/vcpkg/installed/arm-linux/" --disable-examples
#また長い待ち時間
make -j4
make install
cd
root@pynq:~/vcpkg/downloads/libvpx-1.9.0# ./configure --prefix="/root/vcpkg/installed/arm-linux/" --disable-examples
  disabling examples
  enabling vp8_encoder
  enabling vp8_decoder
  enabling vp9_encoder
  enabling vp9_decoder
Configuring for target 'armv7-linux-gcc'
  enabling armv7
  enabling neon
  enabling neon_asm
  enabling unit_tests
  enabling webm_io
  enabling libyuv
Creating makefiles for armv7-linux-gcc libs
Creating makefiles for armv7-linux-gcc tools
Creating makefiles for armv7-linux-gcc docs
root@pynq:~/vcpkg/downloads/libvpx-1.9.0# make install
    [INSTALL] /root/vcpkg/installed/arm-linux/include/vpx/vp8.h
    [INSTALL] /root/vcpkg/installed/arm-linux/include/vpx/vp8cx.h
    [INSTALL] /root/vcpkg/installed/arm-linux/include/vpx/vp8dx.h
    [INSTALL] /root/vcpkg/installed/arm-linux/include/vpx/vpx_codec.h
    [INSTALL] /root/vcpkg/installed/arm-linux/include/vpx/vpx_frame_buffer.h
    [INSTALL] /root/vcpkg/installed/arm-linux/include/vpx/vpx_image.h
    [INSTALL] /root/vcpkg/installed/arm-linux/include/vpx/vpx_integer.h
    [INSTALL] /root/vcpkg/installed/arm-linux/include/vpx/vpx_decoder.h
    [INSTALL] /root/vcpkg/installed/arm-linux/include/vpx/vpx_encoder.h
    [INSTALL] /root/vcpkg/installed/arm-linux/lib/libvpx.a
    [INSTALL] /root/vcpkg/installed/arm-linux/lib/pkgconfig/vpx.pc
make[1]: Nothing to be done for 'install'.
make[1]: Nothing to be done for 'install'.

opusをインストール

mv xiph-opus-5c94ec3205c30171ffd01056f5b4622b7c0ab54c.tar.gz vcpkg/downloads/
cd vcpkg/downloads/
tar zxmf xiph-opus-5c94ec3205c30171ffd01056f5b4622b7c0ab54c.tar.gz
cd opus-5c94ec3205c30171ffd01056f5b4622b7c0ab54c
./autogen.sh
#prefixは自分のvcpkgパスに応じて設定する必要があります
./configure --prefix="/root/vcpkg/installed/arm-linux/" CFLAGS="-Os" --enable-fixed-point --enable-intrinsics --host=arm-linux
make -j4
make install
cd
root@pynq:~/vcpkg/downloads/opus-5c94ec3205c30171ffd01056f5b4622b7c0ab54c# ./autogen.sh
Updating build configuration files, please wait....
libtoolize: putting auxiliary files in '.'.
libtoolize: linking file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: linking file 'm4/libtool.m4'
libtoolize: linking file 'm4/ltoptions.m4'
libtoolize: linking file 'm4/ltsugar.m4'
libtoolize: linking file 'm4/ltversion.m4'
libtoolize: linking file 'm4/lt~obsolete.m4'
configure.ac:38: installing './compile'
configure.ac:36: installing './config.guess'
configure.ac:36: installing './config.sub'
configure.ac:33: installing './install-sh'
configure.ac:33: installing './missing'
Makefile.am:319: warning: '%'-style pattern rules are a GNU make extension
Makefile.am:322: warning: '%'-style pattern rules are a GNU make extension
Makefile.am: installing './INSTALL'
Makefile.am: installing './depcomp'
parallel-tests: installing './test-driver'
configure:
------------------------------------------------------------------------
  opus unknown:  Automatic configuration OK.

    Compiler support:

      C99 var arrays: ................ yes
      C99 lrintf: .................... yes
      Use alloca: .................... no (using var arrays)

    General configuration:

      Floating point support: ........ no
      Fast float approximations: ..... no
      Fixed point debugging: ......... no
      Inline Assembly Optimizations: . ARM (EDSP) (Media)
      External Assembly Optimizations: ARM (EDSP) (Media)
      Intrinsics Optimizations: ...... ARM (NEON)
      Run-time CPU detection: ........ ARM (NEON) (NEON Intrinsics)
      Custom modes: .................. no
      Assertion checking: ............ no
      Hardening: ..................... yes
      Fuzzing: ....................... no
      Check ASM: ..................... no

      API documentation: ............. yes
      Extra programs: ................ yes
------------------------------------------------------------------------

 Type "make; make install" to compile and install
 Type "make check" to run the test suite

ビルド

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
#git clone https://github.com/rustdesk/rustdesk
#現在、rustdesk-1.1.8バージョンのみテストされています
#https://github.com/rustdesk/rustdesk/archive/refs/tags/1.1.8.zip
tar zxmf rustdesk-1.1.8.tar.gz
mv rustdesk-1.1.8 rustdesk
cd rustdesk
#rustdesk/Cargo.tomlの2か所を変更する必要があります:
#3行目:version = "1.1.6"-> version = "1.1.8"
#20行目:whoami = "1.1" -> whoami = "1.2"
#rustdesk/libs/hbb_common/Cargo.tomlの1か所を変更する必要があります:
#27行目:confy = { git = "https://github.com/open-trade/confy" } -> confy = "0.4" 
cargo build --release
#次に長い待ち時間
#ダウンロード段階がスムーズでない場合は、ctrl+cで終了して成功するまで再試行できます
root@pynq:~/rustdesk# cargo build --release
    Updating crates.io index
error: failed to get `block` as a dependency of package `scrap v0.5.0 (/root/rustdesk/libs/scrap)`

Caused by:
  failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  network failure seems to have happened
  if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
  https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli

Caused by:
  SSL error: received early EOF; class=Ssl (16); code=Eof (-20)

#この状況に遭遇しても慌てないでください。再試行するだけです。全プロセスで数回発生する可能性があります。良い方法があれば教えてください^_^
root@pynq:~/rustdesk# cargo build --release
    Updating crates.io index
    Updating git repository `https://github.com/open-trade/confy`
warning: spurious network error (2 tries remaining): SSL error: syscall failure: Broken pipe; class=Os (2)
error: failed to get `confy` as a dependency of package `hbb_common v0.1.0 (/root/rustdesk/libs/hbb_common)`

Caused by:
  failed to load source for dependency `confy`

Caused by:
  Unable to update https://github.com/open-trade/confy#27fa1294

Caused by:
  failed to clone into: /root/.cargo/git/db/confy-90047e480c044d79

Caused by:
  network failure seems to have happened
  if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
  https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli

Caused by:
  SSL error: received early EOF; class=Ssl (16); code=Eof (-20)

#rustdesk/libs/hbb_common/Cargo.tomlの1か所を変更する必要があります:
#27行目:confy = { git = "https://github.com/open-trade/confy" } -> confy = "0.4" 

このステップに到達した場合、おめでとうございます、成功まであとわずかです!

   Compiling rustdesk v1.1.8 (/root/rustdesk)
warning: `hbb_common` (lib) generated 1 warning
    Finished release [optimized] target(s) in 141m 20s

テスト

  • バージョン番号を確認
root@pynq:~/rustdesk# ./target/release/rustdesk --version
1.1.8
  • サービスを実行
root@pynq:~/rustdesk# ./target/release/rustdesk --service
[2022-05-19T06:48:44Z INFO  rustdesk] start --service
[2022-05-19T06:48:46Z INFO  rustdesk] start --server
[2022-05-19T06:48:46Z INFO  rustdesk::server] DISPLAY=Err(NotPresent)
[2022-05-19T06:48:46Z INFO  rustdesk::server] XAUTHORITY=Err(NotPresent)
[2022-05-19T06:48:46Z INFO  rustdesk::ipc] Started ipc server at path: /tmp/RustDesk/ipc
[2022-05-19T06:48:46Z ERROR rustdesk::server::clipboard_service] Failed to start clipboard: Unknown error while interacting with the clipboard: Display parsing error
[2022-05-19T06:48:46Z INFO  rustdesk::common] Testing nat ...
[2022-05-19T06:48:46Z INFO  rustdesk::rendezvous_mediator] start rendezvous mediator of rs-ny.rustdesk.com
[2022-05-19T06:48:46Z INFO  rustdesk::rendezvous_mediator] start rendezvous mediator of rs-sg.rustdesk.com
[2022-05-19T06:48:51Z INFO  rustdesk::rendezvous_mediator] start rendezvous mediator of rs-cn.rustdesk.com
[2022-05-19T06:48:51Z INFO  rustdesk::rendezvous_mediator] register_pk of rs-sg due to key not confirmed
[2022-05-19T06:48:51Z INFO  rustdesk::rendezvous_mediator] register_pk of rs-ny due to key not confirmed
[2022-05-19T06:48:51Z INFO  rustdesk::rendezvous_mediator] machine uid: 1bb53cb1093f458aa5d68063d06aa39f
[2022-05-19T06:48:51Z INFO  rustdesk::rendezvous_mediator] machine uid: 1bb53cb1093f458aa5d68063d06aa39f
[2022-05-19T06:48:51Z INFO  rustdesk::rendezvous_mediator] register_pk of rs-cn due to key not confirmed
[2022-05-19T06:48:51Z INFO  rustdesk::rendezvous_mediator] machine uid: 1bb53cb1093f458aa5d68063d06aa39f
[2022-05-19T06:48:51Z INFO  rustdesk::rendezvous_mediator] UUID_MISMATCH received from rs-cn.rustdesk.com
[2022-05-19T06:48:51Z INFO  hbb_common::config] id updated from xxxxxx to xxxxxxx (hide id)
[2022-05-19T06:48:51Z INFO  rustdesk::rendezvous_mediator] machine uid: 1bb53cb1093f458aa5d68063d06aa39f
[2022-05-19T06:48:52Z INFO  rustdesk::common] Tested nat type: ASYMMETRIC in 6.084360199s
[2022-05-19T06:49:04Z INFO  rustdesk::rendezvous_mediator] register_pk of rs-sg due to key not confirmed
[2022-05-19T06:49:04Z INFO  rustdesk::rendezvous_mediator] machine uid: 1bb53cb1093f458aa5d68063d06aa39f
[2022-05-19T06:49:04Z INFO  rustdesk::rendezvous_mediator] register_pk of rs-ny due to key not confirmed
[2022-05-19T06:49:04Z INFO  rustdesk::rendezvous_mediator] machine uid: 1bb53cb1093f458aa5d68063d06aa39f
[2022-05-19T06:49:05Z INFO  rustdesk::rendezvous_mediator] register_pk of rs-sg due to key not confirmed
[2022-05-19T06:49:05Z INFO  rustdesk::rendezvous_mediator] machine uid: 1bb53cb1093f458aa5d68063d06aa39f

あまり早く喜ばないでください。サービスを開始するとIDが取得されるだけで、他の端末からアクセスできるようにするにはパスワードを設定する必要があります。

  • パスワードを設定
root@pynq:~/rustdesk# ./target/release/rustdesk --password qwertyuiop123123 #パスワードは任意に設定してください、これは単なる例です
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Connection refused (os error 111)', src/main.rs:106:55
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
#エラーメッセージがありますが、パスワードの設定には影響しません
  • サービスを再起動し、接続を待つ
root@pynq:~/rustdesk# ./target/release/rustdesk --service &
[1] 20186

すぐにPC版のrustdeskを開いて直接接続することができますが、接続後に次のことがわかります

Unsupported display server type tty,x11 expected

デスクトップを表示したい場合は、sciterのサポートが必要になる場合があります。次に、Windows PCまたはLinux PCにrustdeskがインストールされていることを前提として、コマンドライン接続の方法を提供します。Windows 7を例にして、ターゲットマシンのSSH機能をテストします:

#RustDeskをインストールした場所を見つける
C:\Users\Administrator\Desktop>cd C:\Program Files\RustDesk 
C:\Program Files\RustDesk>RustDesk.exe --port-forward ur_dev_id 11000 127.0.0.1 22

次に、SSHクライアントを使用してローカルIPとポートに接続します

Connecting to 127.0.0.1:11000...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Welcome to PYNQ Linux, based on Ubuntu 18.04 (GNU/Linux 4.14.0-xilinx armv7l)

 * Super-optimized for small spaces - read how we shrank the memory
   footprint of MicroK8s to make it the smallest full K8s around.

   https://ubuntu.com/blog/microk8s-memory-optimisation
Last login: Thu May 19 07:33:22 2022 from 127.0.0.1
root@pynq:~# 

接続プロセス中に、リモートマシンのパスワードを入力するウィンドウがポップアップ表示されます。「パスワードを記憶する」をチェックすることをお勧めします。これにより、次回はrustdeskアプリで接続履歴を直接確認し、コマンドラインではなくアプリのTCPトンネル機能を使用して直接接続できます。もちろん、@rustdeskに、アプリインターフェースの[ファイル転送]ボタンの左側に[TCPトンネル]ボタンを追加することを提案するのが最良です。これにより、コマンドラインを使用せずにターゲットデバイスに接続できます。