Coder Social home page Coder Social logo

Examples not building for OSX about rodio HOT 3 CLOSED

rustaudio avatar rustaudio commented on July 17, 2024 1
Examples not building for OSX

from rodio.

Comments (3)

notryanb avatar notryanb commented on July 17, 2024

@tomaka I'd like to try and help with this issue, however I'm still pretty new to rust (especially rust concurrency). Currently reading through rodio, cpal, and coreaudio-rs libs. Any idea where I should try to focus my efforts?

from rodio.

tomaka avatar tomaka commented on July 17, 2024

I'm not sure myself (haven't really looked yet).
Basically cpal forbids sharing something between threads (not sure exactly which object is concerned, and whether it is legitimate or not), while rodio tries to share it and fails.

from rodio.

martinlindhe avatar martinlindhe commented on July 17, 2024

I hit the same error I guess (examples not building on macOS), but got a more verbose stack trace.

Posting it here in hope it is useful. If not, sorry for the noise.

rustc 1.24.0-nightly (1956d5535 2017-12-03), macOS 10.13.1

cargo run --example music_ogg
...
error[E0277]: the trait bound `for<'r> std::ops::FnMut(cpal::cpal_impl::VoiceId, cpal::UnknownTypeBuffer<'r>) + 'static: std::marker::Send` is not satisfied
  --> src/engine.rs:35:18
   |
35 |                 .spawn({
   |                  ^^^^^ `for<'r> std::ops::FnMut(cpal::cpal_impl::VoiceId, cpal::UnknownTypeBuffer<'r>) + 'static` cannot be sent between threads safely
   |
   = help: the trait `std::marker::Send` is not implemented for `for<'r> std::ops::FnMut(cpal::cpal_impl::VoiceId, cpal::UnknownTypeBuffer<'r>) + 'static`
   = note: required because of the requirements on the impl of `std::marker::Send` for `&'static mut for<'r> std::ops::FnMut(cpal::cpal_impl::VoiceId, cpal::UnknownTypeBuffer<'r>) + 'static`
   = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<&'static mut for<'r> std::ops::FnMut(cpal::cpal_impl::VoiceId, cpal::UnknownTypeBuffer<'r>) + 'static>`
   = note: required because it appears within the type `alloc::raw_vec::RawVec<&'static mut for<'r> std::ops::FnMut(cpal::cpal_impl::VoiceId, cpal::UnknownTypeBuffer<'r>) + 'static>`
   = note: required because it appears within the type `std::vec::Vec<&'static mut for<'r> std::ops::FnMut(cpal::cpal_impl::VoiceId, cpal::UnknownTypeBuffer<'r>) + 'static>`
   = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Mutex<std::vec::Vec<&'static mut for<'r> std::ops::FnMut(cpal::cpal_impl::VoiceId, cpal::UnknownTypeBuffer<'r>) + 'static>>`
   = note: required because it appears within the type `cpal::cpal_impl::ActiveCallbacks`
   = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<cpal::cpal_impl::ActiveCallbacks>`
   = note: required because it appears within the type `cpal::cpal_impl::EventLoop`
   = note: required because it appears within the type `cpal::EventLoop`
   = note: required because it appears within the type `engine::Engine`
   = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<engine::Engine>`
   = note: required because it appears within the type `[closure@src/engine.rs:37:21: 41:22 engine:std::sync::Arc<engine::Engine>]`

error[E0277]: the trait bound `for<'r> std::ops::FnMut(cpal::cpal_impl::VoiceId, cpal::UnknownTypeBuffer<'r>) + 'static: std::marker::Send` is not satisfied
  --> src/engine.rs:23:5
   |
23 | /     lazy_static! {
24 | |         static ref ENGINE: Arc<Engine> = {
25 | |             let engine = Arc::new(Engine {
26 | |                 events_loop: EventLoop::new(),
...  |
47 | |         };
48 | |     }
   | |_____^ `for<'r> std::ops::FnMut(cpal::cpal_impl::VoiceId, cpal::UnknownTypeBuffer<'r>) + 'static` cannot be sent between threads safely
   |
   = help: the trait `std::marker::Send` is not implemented for `for<'r> std::ops::FnMut(cpal::cpal_impl::VoiceId, cpal::UnknownTypeBuffer<'r>) + 'static`
   = note: required because of the requirements on the impl of `std::marker::Send` for `&'static mut for<'r> std::ops::FnMut(cpal::cpal_impl::VoiceId, cpal::UnknownTypeBuffer<'r>) + 'static`
   = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<&'static mut for<'r> std::ops::FnMut(cpal::cpal_impl::VoiceId, cpal::UnknownTypeBuffer<'r>) + 'static>`
   = note: required because it appears within the type `alloc::raw_vec::RawVec<&'static mut for<'r> std::ops::FnMut(cpal::cpal_impl::VoiceId, cpal::UnknownTypeBuffer<'r>) + 'static>`
   = note: required because it appears within the type `std::vec::Vec<&'static mut for<'r> std::ops::FnMut(cpal::cpal_impl::VoiceId, cpal::UnknownTypeBuffer<'r>) + 'static>`
   = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Mutex<std::vec::Vec<&'static mut for<'r> std::ops::FnMut(cpal::cpal_impl::VoiceId, cpal::UnknownTypeBuffer<'r>) + 'static>>`
   = note: required because it appears within the type `cpal::cpal_impl::ActiveCallbacks`
   = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<cpal::cpal_impl::ActiveCallbacks>`
   = note: required because it appears within the type `cpal::cpal_impl::EventLoop`
   = note: required because it appears within the type `cpal::EventLoop`
   = note: required because it appears within the type `engine::Engine`
   = note: required because of the requirements on the impl of `std::marker::Sync` for `std::sync::Arc<engine::Engine>`
   = note: required by `<engine::play_raw::ENGINE as std::ops::Deref>::deref::require_sync`
   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

from rodio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.