bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust

Home Page:https://bevyengine.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WASM Won't Compile with bevy_log

billyb2 opened this issue · comments

Bevy version

f4cfcc0

Operating system & version

Arch Linux

What you did

cargo build --target wasm32-unknown-unknown -Zunstable-options -Zbuild-std=panic_abort,std
It compiles fine until it reaches bevy_log:

error[E0277]: the trait bound `WASMLayer: __tracing_subscriber_Layer<Layered<EnvFilter, Registry>>` is not satisfied
   --> /home/billy/.cargo/git/checkouts/bevy-f7ffde730c324c74/f4cfcc0/crates/bevy_log/src/lib.rs:135:46
    |
135 |               let subscriber = subscriber.with(tracing_wasm::WASMLayer::new(
    |  _________________________________________----_^
    | |                                         |
    | |                                         required by a bound introduced by this call
136 | |                 tracing_wasm::WASMLayerConfig::default(),
137 | |             ));
    | |_____________^ the trait `__tracing_subscriber_Layer<Layered<EnvFilter, Registry>>` is not implemented for `WASMLayer`

error[E0277]: the trait bound `WASMLayer: __tracing_subscriber_Layer<Layered<EnvFilter, Registry>>` is not satisfied
   --> /home/billy/.cargo/git/checkouts/bevy-f7ffde730c324c74/f4cfcc0/crates/bevy_log/src/lib.rs:138:65
    |
138 |             bevy_utils::tracing::subscriber::set_global_default(subscriber)
    |             --------------------------------------------------- ^^^^^^^^^^ the trait `__tracing_subscriber_Layer<Layered<EnvFilter, Registry>>` is not implemented for `WASMLayer`
    |             |
    |             required by a bound introduced by this call
    |
    = note: required because of the requirements on the impl of `bevy_utils::tracing::Subscriber` for `Layered<WASMLayer, Layered<EnvFilter, Registry>>`
note: required by a bound in `bevy_utils::tracing::subscriber::set_global_default`
   --> /home/billy/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-0.1.29/src/subscriber.rs:41:8
    |
41  |     S: Subscriber + Send + Sync + 'static,
    |        ^^^^^^^^^^ required by this bound in `bevy_utils::tracing::subscriber::set_global_default`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `bevy_log` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: build failed

What you expected to happen

For it to compile

What actually happened

A build failure

Additional information

Quick fix: cargo update -p tracing-wasm --precise 0.2.0

See Discord message with the same issue: https://discord.com/channels/691052431525675048/750833140746158140/907077223960432710

should be fixed on main by #3102, but it's still an issue on 0.5

Thank you! I've been using the main branch. Should i keep this issue open?

Please keep it open until a decision has been made for 0.5

commented

Sorry, I don't know why my repository reference appeared on the timeline.
Please ignore my reference.
The commit message on my project never help anybody.

I was on the same trouble ,too.
And NiklasEi' solution works!
Everything is fine now.

Closing as fixed by #3102.