やってみる

アウトプットすべく己を導くためのブログ。その試行錯誤すらたれ流す。

RustゲームエンジンBevyをインストールするもラズパイではビルドエラーになった

 ARMv7だとダメらしい。

成果物

情報源

インストール

Rust

$ rustup update
...
  stable-armv7-unknown-linux-gnueabihf updated - rustc 1.53.0 (53cb7b09b 2021-06-17) (from rustc 1.49.0 (e1884a8e3 2020-12-29))
$ cargo --version
cargo 1.53.0 (4369396ce 2021-04-27)

必要なツール

sudo apt -y install g++ pkg-config libx11-dev libasound2-dev libudev-dev

プロジェクトをつくる

cargo new hello_bevy --bin
cd hello_bevy

bevy

 Cargo.toml[dependencies]bevy = "0.5"を追記する。

Cargo.toml

[package]
name = "hello_bevy"
version = "0.1.0"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bevy = "0.5"

実行する

 エラーになった。

cargo run
...
error: failed to run custom build command for `bevy-glsl-to-spirv v0.2.1`

Caused by:
  process didn't exit successfully: `/tmp/work/hello_bevy/target/debug/build/bevy-glsl-to-spirv-fcd6ecfac2d5aaad/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at 'Missing target support armv7-unknown-linux-gnueabihf', /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/bevy-glsl-to-spirv-0.2.1/build/build.rs:24:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed

 上記build.rsのコード抜粋。私のマシンであるラズパイのCPUはarmv7-unknown-linux-gnueabihfなのだろうが、それに対応するコードが以下のどこにもない。

...
    if target.contains("x86_64-pc-windows-msvc") {
        bin_dir.push("windows");
    } else if target.contains("x86_64-unknown-linux-gnu") {
        bin_dir.push("linux");
    } else if target.contains("x86_64-apple-darwin") {
        bin_dir.push("osx");
    } else if target.contains("android") {
        if target.contains("aarch64") {
            bin_dir.push("android-arm64-v8a");
        } else if target.contains("armv7") {
            bin_dir.push("android-armeabi-v7a");
        } else {
            panic!("Missing Android target support {}", target);
        }
    } else {
        panic!("Missing target support {}", target);
    };
...

githubからコードを入手してexampleを動かそうとしたがエラー

git clone https://github.com/bevyengine/bevy
cd bevy
cargo run --example breakout 
...
   Compiling bevy v0.5.0 (/tmp/work/bevy)
    Finished dev [unoptimized + debuginfo] target(s) in 36m 08s
     Running `target/debug/examples/breakout`
thread 'main' panicked at 'Unable to find a GPU! Make sure you have installed required drivers!', crates/bevy_wgpu/src/wgpu_renderer.rs:47:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

 GPUが見つからないと怒られる。やはりラズパイでは実行できないのか。

所感

 ラズパイでは使えなかった。ARMv7非対応のソフトウェア多すぎる。

対象環境

$ uname -a
Linux raspberrypi 5.4.83-v7l+ #1379 SMP Mon Dec 14 13:11:54 GMT 2020 armv7l GNU/Linux