Pioneer_11
Pioneer_11

Reputation: 1280

Error building alsa-sys and libudev-sys for Bevy

I am trying to get started with bevy, I have set up the environment as suggested by the bevy book including using the nightly tool chain. However, when I try to build bevy I get the messages:

error: failed to run custom build command for `alsa-sys v0.3.1`
error: failed to run custom build command for `libudev-sys v0.1.4`

my cargo.toml is:

[package]
name = "Bevy_1"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[profile.dev]
opt-level = 1

[profile.dev.package."*"]
opt-level = 3

[dependencies]
bevy = {version = "0.10", features = ["dynamic_linking"]}

and my rust-toolchain.toml is:

[toolchain]
channel = "nightly"

How can I solve this?

Upvotes: 8

Views: 4822

Answers (2)

frankenapps
frankenapps

Reputation: 8311

You will need to install the required dependencies for your Linux distribution. For example, install the following dependencies on Ubuntu:

sudo apt-get install g++ pkg-config libx11-dev libasound2-dev libudev-dev libxkbcommon-x11-0

If you are using Wayland, then install these:

sudo apt-get install libwayland-dev libxkbcommon-dev

This is also covered in the bevy book for all major (desktop) operating systems over getting started setup section.

Upvotes: 6

Bourumir Wyngs
Bourumir Wyngs

Reputation: 11

These errors may also happen on a system where it is not possible to install such dependencies (like on GitHub).

You can exclude some optional dependencies based on your needs. For example, if you don’t need sound, you can omit the sound module. To do this, disable Bevy’s default features, then re-enable only the necessary ones. Gradually remove modules one by one until the build succeeds without breaking your code.

For instance, here is the final Bevy configuration that works for me with the simple visualization of the robot:

bevy = { version = "0.12", default-features = false, features = [
    "animation", "bevy_scene", "bevy_winit",
    "bevy_pbr", "bevy_render", "bevy_text", "bevy_ui", "multi-threaded", "hdr",
    "x11", "wayland", "tonemapping_luts", "default_font",
]}

bevy_audio is not included, and the very menacingly sounding bevy_core_pipeline also removed - works without.

Upvotes: 1

Related Questions