LoginSignup
5
2

More than 3 years have passed since last update.

Amethystいじろうとしたら動かなかった問題

Posted at

序文

https://qiitadon.com/@celluloce/102359220990915198
上リンクのまとめ。
RustのゲームエンジンであるAmethystをいじろうとしたら見たことないエラーに見舞われたのでその解決までの手順をまとめた。

環境

  • rustc 1.35.0
  • Ubuntu 18.04.2 LTS
  • Radeon RX 570 Series
  • amethyst 0.11.1

Exampleが動かない

https://github.com/amethyst/amethyst
AmethystのGithubからgit cloneして$cargo run --example pongで走らせても動かなかった。

エラー文は以下の通り。引用

You must specify at least one graphical backend feature: `vulan`, `metal`, `empty`. See the wiki article https://github.com/amethyst/amethyst/wiki/GraphicalBackendError for more details.

解決法

https://github.com/amethyst/amethyst/wiki/GraphicalBackendError
上文献を参考にすればよし。

Exampleを走らせたいなら以下コマンドを打てばいい。

$ cargo run --example pong --features "vulkan"

また自作ゲームを作る場合、以下文をCargo.tomに記述する必要がある。

Cargo.toml
[features]
vulkan = ["amethyst/vulkan"]
metal = ["amethyst/metal"]

その後$ cargo run --features "vulkan"すればいい。

これで一部のExampleが動いた。(そう一部だけ)

一部のExampleが動かない

上記した方法でwindow等のExampleは動いたが、pong, fly_camera等で以下エラーが出た。

thread 'main' panicked at 'Unable to load Vulkan entry points: LibraryLoadError("libvulkan.so.1: cannot open shared object file: No such file or directory")', src/libcore/result.rs:997:5

足りないファイルを入れてみる

libvulkan.so.1ファイルが無いようなので、以下コマンドを打ってみた。

$ sudo apt install vulkan-utils libvulkan1 libvulkan-dev

違うエラーが出てきた。

[WARN][gfx_backend_vulkan] Unable to find extension: VK_KHR_surface
[WARN][gfx_backend_vulkan] Unable to find extension: VK_KHR_xlib_surface
[WARN][gfx_backend_vulkan] Unable to find extension: VK_KHR_xcb_surface
[WARN][gfx_backend_vulkan] Unable to find extension: VK_KHR_wayland_surface
thread 'main' panicked at 'Unable to create Vulkan instance: VkError(ERROR_INCOMPATIBLE_DRIVER)', src/libcore/result.rs:997:5

ちなみに$ vulkaninfo打ったら上記にもあるERROR_INCOMPATIBLE_DRIVERが出てきた。

GPUドライバの問題では

Ubuntu + Radeon環境でVulkan動かすにはどうすればいいか調べた。

上文献に従って以下コマンドを打った。
(前にGPUドライバ入れた記憶があるのだが衝突とかしないだろうか...)

$ sudo add-apt-repository ppa:oibaf/graphics-drivers
$ sudo apt update
$ sudo apt upgrade
$ sudo apt install libvulkan1 mesa-vulkan-drivers vulkan-utils

して、再び$ cargo run --example pong --features "vulkan"を打った。

したら動いた。

まとめ

Amethystを使うにはVulkan環境が必要になったようだ。
(設定次第で必要なくなるだろうが知らん)

5
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2