bevy: Bevy 0.5.0 can't run with DefaultPlugins: BackendSpecificError

Bevy version

bevy = “0.5.0”

Operating system & version

Arch Linux x86_64 5.10.42-1-lts DE: KDE Plasma

What you did

cargo new cant_load_default_plugin
cd cant_load_default_plugin
printf 'use bevy::prelude::*;\nfn main() { App::build().add_plugins(DefaultPlugins).run(); }' > src/main.rs
echo 'bevy = "0.5.0"' >> Cargo.toml
cargo run

What you expected to happen

The program should build

What actually happened

5 compilation errors about use of unstable library feature

I then tried

rustup override set nightly
RUST_BACKTRACE=1 cargo run

but then

thread 'main' panicked at 'build_output_stream failed with all supported formats: BackendSpecific { err: BackendSpecificError { description: "ALSA function 'snd_pcm_start' failed with error 'EBADFD: File descriptor in bad state'" } }', $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/rodio-0.13.1/src/stream.rs:208:22
stack backtrace:
   0: rust_begin_unwind
             at /rustc/dbe459dedd33470f2cb28101157de316caaffa66/library/std/src/panicking.rs:515:5
   1: core::panicking::panic_fmt
             at /rustc/dbe459dedd33470f2cb28101157de316caaffa66/library/core/src/panicking.rs:92:14
   2: core::result::unwrap_failed
             at /rustc/dbe459dedd33470f2cb28101157de316caaffa66/library/core/src/result.rs:1355:5
   3: core::result::Result<T,E>::expect
             at /rustc/dbe459dedd33470f2cb28101157de316caaffa66/library/core/src/result.rs:997:23
   4: <cpal::platform::platform_impl::Device as rodio::stream::CpalDeviceExt>::try_new_output_stream::{{closure}}
             at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/rodio-0.13.1/src/stream.rs:204:17
   5: core::result::Result<T,E>::unwrap_or_else
             at /rustc/dbe459dedd33470f2cb28101157de316caaffa66/library/core/src/result.rs:821:23
   6: <cpal::platform::platform_impl::Device as rodio::stream::CpalDeviceExt>::try_new_output_stream
             at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/rodio-0.13.1/src/stream.rs:200:12
   7: rodio::stream::OutputStream::try_from_device
             at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/rodio-0.13.1/src/stream.rs:31:32
   8: rodio::stream::OutputStream::try_default
             at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/rodio-0.13.1/src/stream.rs:45:9
   9: <bevy_audio::audio_output::AudioOutput<P> as core::default::Default>::default
             at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_audio-0.5.0/src/audio_output.rs:22:39
  10: <T as bevy_ecs::world::FromWorld>::from_world
             at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.5.0/src/world/mod.rs:928:9
  11: bevy_app::app_builder::AppBuilder::init_non_send_resource
             at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_app-0.5.0/src/app_builder.rs:272:28
  12: <bevy_audio::AudioPlugin as bevy_app::plugin::Plugin>::build
             at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_audio-0.5.0/src/lib.rs:23:9
  13: bevy_app::plugin_group::PluginGroupBuilder::finish
             at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_app-0.5.0/src/plugin_group.rs:104:21
  14: bevy_app::app_builder::AppBuilder::add_plugins
             at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_app-0.5.0/src/app_builder.rs:295:9
  15: cant_load_default_plugin::main
             at ./src/main.rs:1:35
  16: core::ops::function::FnOnce::call_once
             at /rustc/dbe459dedd33470f2cb28101157de316caaffa66/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

I also tried this src/main.rs, and this runs and exits instantly without any error, while I expected it to never exit

use bevy::prelude::*;
fn main() {
    App::build()
        .add_plugin(bevy::log::LogPlugin::default())
        .add_plugin(bevy::core::CorePlugin::default())
        .add_plugin(bevy::transform::TransformPlugin::default())
        .add_plugin(bevy::diagnostic::DiagnosticsPlugin::default())
        .add_plugin(bevy::input::InputPlugin::default())
        .add_plugin(bevy::window::WindowPlugin::default())
        .add_plugin(bevy::asset::AssetPlugin::default())
        .add_plugin(bevy::scene::ScenePlugin::default())
        .run();
}

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 16 (8 by maintainers)

Most upvoted comments

5 compilation errors about use of unstable library feature

  1. Bevy requires the latest stable, that’s the reason for your compilation errors

Nightly

  1. Seems like your ALSA install has problems: "ALSA function 'snd_pcm_start' failed with error 'EBADFD: File descriptor in bad state'" Did you take a look here? https://github.com/bevyengine/bevy/blob/main/docs/linux_dependencies.md#arch--manjaro For now, you could disable the bevy_audio and mp3 Features to still compile

I also tried this src/main.rs, and this runs and exits instantly without any error, while I expected it to never exit

  1. Bevy needs a runner to drive the update loop/keep Bevy running, but you are missing WinitPlugin which provides it in Bevy.

@kugiyasan Is it ok then if we close out this issue since your primary concern was solved?

Bevy version

bevy = “0.5.0”

Operating system & version

Arch Linux x86_64 5.10.42-1-lts

DE: KDE Plasma

What you did


cargo new cant_load_default_plugin

cd cant_load_default_plugin

printf 'use bevy::prelude::*;\nfn main() { App::build().add_plugins(DefaultPlugins).run(); }' > src/main.rs

echo 'bevy = "0.5.0"' >> Cargo.toml

cargo run

What you expected to happen

The program should build

What actually happened

5 compilation errors about use of unstable library feature

I then tried


rustup override set nightly

RUST_BACKTRACE=1 cargo run

but then


thread 'main' panicked at 'build_output_stream failed with all supported formats: BackendSpecific { err: BackendSpecificError { description: "ALSA function 'snd_pcm_start' failed with error 'EBADFD: File descriptor in bad state'" } }', $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/rodio-0.13.1/src/stream.rs:208:22

stack backtrace:

   0: rust_begin_unwind

             at /rustc/dbe459dedd33470f2cb28101157de316caaffa66/library/std/src/panicking.rs:515:5

   1: core::panicking::panic_fmt

             at /rustc/dbe459dedd33470f2cb28101157de316caaffa66/library/core/src/panicking.rs:92:14

   2: core::result::unwrap_failed

             at /rustc/dbe459dedd33470f2cb28101157de316caaffa66/library/core/src/result.rs:1355:5

   3: core::result::Result<T,E>::expect

             at /rustc/dbe459dedd33470f2cb28101157de316caaffa66/library/core/src/result.rs:997:23

   4: <cpal::platform::platform_impl::Device as rodio::stream::CpalDeviceExt>::try_new_output_stream::{{closure}}

             at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/rodio-0.13.1/src/stream.rs:204:17

   5: core::result::Result<T,E>::unwrap_or_else

             at /rustc/dbe459dedd33470f2cb28101157de316caaffa66/library/core/src/result.rs:821:23

   6: <cpal::platform::platform_impl::Device as rodio::stream::CpalDeviceExt>::try_new_output_stream

             at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/rodio-0.13.1/src/stream.rs:200:12

   7: rodio::stream::OutputStream::try_from_device

             at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/rodio-0.13.1/src/stream.rs:31:32

   8: rodio::stream::OutputStream::try_default

             at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/rodio-0.13.1/src/stream.rs:45:9

   9: <bevy_audio::audio_output::AudioOutput<P> as core::default::Default>::default

             at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_audio-0.5.0/src/audio_output.rs:22:39

  10: <T as bevy_ecs::world::FromWorld>::from_world

             at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.5.0/src/world/mod.rs:928:9

  11: bevy_app::app_builder::AppBuilder::init_non_send_resource

             at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_app-0.5.0/src/app_builder.rs:272:28

  12: <bevy_audio::AudioPlugin as bevy_app::plugin::Plugin>::build

             at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_audio-0.5.0/src/lib.rs:23:9

  13: bevy_app::plugin_group::PluginGroupBuilder::finish

             at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_app-0.5.0/src/plugin_group.rs:104:21

  14: bevy_app::app_builder::AppBuilder::add_plugins

             at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_app-0.5.0/src/app_builder.rs:295:9

  15: cant_load_default_plugin::main

             at ./src/main.rs:1:35

  16: core::ops::function::FnOnce::call_once

             at /rustc/dbe459dedd33470f2cb28101157de316caaffa66/library/core/src/ops/function.rs:227:5

note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

I also tried this src/main.rs, and this runs and exits instantly without any error, while I expected it to never exit


use bevy::prelude::*;

fn main() {

    App::build()

        .add_plugin(bevy::log::LogPlugin::default())

        .add_plugin(bevy::core::CorePlugin::default())

        .add_plugin(bevy::transform::TransformPlugin::default())

        .add_plugin(bevy::diagnostic::DiagnosticsPlugin::default())

        .add_plugin(bevy::input::InputPlugin::default())

        .add_plugin(bevy::window::WindowPlugin::default())

        .add_plugin(bevy::asset::AssetPlugin::default())

        .add_plugin(bevy::scene::ScenePlugin::default())

        .run();

}

#2269 also should have fixed that bevy panicks in your case. (Though you will still be missing audio)

Oops noob mistake, my stable was 1.49.0, I just had to rustup update. I somehow thought that rust would magically keep my stable always up to date…

$ cargo --version
cargo 1.52.0 (69767412a 2021-04-21)
$ rustc --version
rustc 1.52.1 (9bc8c42bb 2021-05-09)
For now, you could disable the `bevy_audio` and `mp3` Features to still compile

I still need to disable bevy_audio and mp3 to be able to run the program. It’s not a problem for me, since I don’t have intentions to touch the audio for now, but this still needs further investigation ig