AbletonLink_JuceSampler icon indicating copy to clipboard operation
AbletonLink_JuceSampler copied to clipboard

Constructor crashes when compiled to a bundle, and loaded into unity

Open MeijisIrlnd opened this issue 1 year ago • 0 comments

Hey, first off thanks so much for putting this guide together, super helpful! I realise this is a suuper niche scenario, I'm working on a project which uses Juce as the audio backend, and Unity as the frontend, so we have a dynamic library that unity loads, and calls functions from. I've been trying to integrate Link into this setup, and it works fine on windows, but on mac, calling the ableton::Link constructor crashes, with the relevant stack trace being:

#0  0x0000019b8697ec in asio::detail::conditionally_enabled_mutex::scoped_lock::scoped_lock(asio::detail::conditionally_enabled_mutex&)
#1  0x0000019b86949d in asio::detail::conditionally_enabled_mutex::scoped_lock::scoped_lock(asio::detail::conditionally_enabled_mutex&)
#2  0x0000019b87b1f1 in asio::detail::scheduler::init_task()
#3  0x0000019b87b1c9 in asio::detail::kqueue_reactor::init_task()
#4  0x0000019b891dfb in asio::detail::deadline_timer_service<asio::detail::chrono_time_traits<std::__1::chrono::system_clock, asio::wait_traits<std::__1::chrono::system_clock> > >::deadline_timer_service(asio::execution_context&)
#5  0x0000019b891d6d in asio::detail::deadline_timer_service<asio::detail::chrono_time_traits<std::__1::chrono::system_clock, asio::wait_traits<std::__1::chrono::system_clock> > >::deadline_timer_service(asio::execution_context&)
#6  0x0000019b891d20 in asio::execution_context::service* asio::detail::service_registry::create<asio::detail::deadline_timer_service<asio::detail::chrono_time_traits<std::__1::chrono::system_clock, asio::wait_traits<std::__1::chrono::system_clock> > >, asio::io_context>(void*)
#7  0x0000019b8677ea in asio::detail::service_registry::do_use_service(asio::execution_context::service::key const&, asio::execution_context::service* (*)(void*), void*)
#8  0x0000019b891cae in asio::detail::deadline_timer_service<asio::detail::chrono_time_traits<std::__1::chrono::system_clock, asio::wait_traits<std::__1::chrono::system_clock> > >& asio::detail::service_registry::use_service<asio::detail::deadline_timer_service<asio::detail::chrono_time_traits<std::__1::chrono::system_clock, asio::wait_traits<std::__1::chrono::system_clock> > > >(asio::io_context&)
#9  0x0000019b891bcc in asio::detail::deadline_timer_service<asio::detail::chrono_time_traits<std::__1::chrono::system_clock, asio::wait_traits<std::__1::chrono::system_clock> > >& asio::use_service<asio::detail::deadline_timer_service<asio::detail::chrono_time_traits<std::__1::chrono::system_clock, asio::wait_traits<std::__1::chrono::system_clock> > > >(asio::io_context&)
#10 0x0000019b891af7 in asio::detail::io_object_impl<asio::detail::deadline_timer_service<asio::detail::chrono_time_traits<std::__1::chrono::system_clock, asio::wait_traits<std::__1::chrono::system_clock> > >, asio::any_io_executor>::io_object_impl<asio::io_context>(int, int, asio::io_context&)
#11 0x0000019b891ac9 in asio::detail::io_object_impl<asio::detail::deadline_timer_service<asio::detail::chrono_time_traits<std::__1::chrono::system_clock, asio::wait_traits<std::__1::chrono::system_clock> > >, asio::any_io_executor>::io_object_impl<asio::io_context>(int, int, asio::io_context&)
#12 0x0000019b891a94 in asio::basic_waitable_timer<std::__1::chrono::system_clock, asio::wait_traits<std::__1::chrono::system_clock>, asio::any_io_executor>::basic_waitable_timer<asio::io_context>(asio::io_context&, asio::constraint<is_convertible<asio::io_context&, asio::execution_context&>::value, int>::type)
#13 0x0000019b8919d3 in asio::basic_waitable_timer<std::__1::chrono::system_clock, asio::wait_traits<std::__1::chrono::system_clock>, asio::any_io_executor>::basic_waitable_timer<asio::io_context>(asio::io_context&, asio::constraint<is_convertible<asio::io_context&, asio::execution_context&>::value, int>::type)
#14 0x0000019b891942 in ableton::platforms::asio::AsioTimer::AsioTimer(asio::io_context&)
#15 0x0000019b8918ed in ableton::platforms::asio::AsioTimer::AsioTimer(asio::io_context&)
#16 0x0000019b8917c0 in ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory>::makeTimer() const
#17 0x0000019b8f370b in ableton::link::Sessions<ableton::link::Peers<ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory>&, std::__1::reference_wrapper<ableton::link::Controller<std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock, ableton::platforms::stl::Random, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory> >::SessionPeerCounter>, ableton::link::Controller<std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock, ableton::platforms::stl::Random, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory> >::SessionTimelineCallback, ableton::link::Controller<std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock, ableton::platforms::stl::Random, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory> >::SessionStartStopStateCallback>&, ableton::link::Controller<std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock, ableton::platforms::stl::Random, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory> >::MeasurePeer, ableton::link::Controller<std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock, ableton::platforms::stl::Random, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory> >::JoinSessionCallback, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory>&, ableton::platforms::darwin::Clock>::Sessions(ableton::link::Session, ableton::util::Injected<ableton::link::Peers<ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory>&, std::__1::reference_wrapper<ableton::link::Controller<std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock, ableton::platforms::stl::Random, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory> >::SessionPeerCounter>, ableton::link::Controller<std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock, ableton::platforms::stl::Random, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory> >::SessionTimelineCallback, ableton::link::Controller<std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock, ableton::platforms::stl::Random, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory> >::SessionStartStopStateCallback>&>, ableton::link::Controller<std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock, ableton::platforms::stl::Random, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory> >::MeasurePeer, ableton::link::Controller<std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock, ableton::platforms::stl::Random, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory> >::JoinSessionCallback, ableton::util::Injected<ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory>&>, ableton::platforms::darwin::Clock)
#18 0x0000019b864747 in ableton::link::Sessions<ableton::link::Peers<ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory>&, std::__1::reference_wrapper<ableton::link::Controller<std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock, ableton::platforms::stl::Random, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory> >::SessionPeerCounter>, ableton::link::Controller<std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock, ableton::platforms::stl::Random, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory> >::SessionTimelineCallback, ableton::link::Controller<std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock, ableton::platforms::stl::Random, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory> >::SessionStartStopStateCallback>&, ableton::link::Controller<std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock, ableton::platforms::stl::Random, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory> >::MeasurePeer, ableton::link::Controller<std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock, ableton::platforms::stl::Random, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory> >::JoinSessionCallback, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory>&, ableton::platforms::darwin::Clock>::Sessions(ableton::link::Session, ableton::util::Injected<ableton::link::Peers<ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory>&, std::__1::reference_wrapper<ableton::link::Controller<std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock, ableton::platforms::stl::Random, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory> >::SessionPeerCounter>, ableton::link::Controller<std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock, ableton::platforms::stl::Random, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory> >::SessionTimelineCallback, ableton::link::Controller<std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock, ableton::platforms::stl::Random, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory> >::SessionStartStopStateCallback>&>, ableton::link::Controller<std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock, ableton::platforms::stl::Random, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory> >::MeasurePeer, ableton::link::Controller<std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock, ableton::platforms::stl::Random, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory> >::JoinSessionCallback, ableton::util::Injected<ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory>&>, ableton::platforms::darwin::Clock)
#19 0x0000019b863d8e in ableton::link::Controller<std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock, ableton::platforms::stl::Random, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory> >::Controller(ableton::link::Tempo, std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock)
#20 0x0000019b859729 in ableton::link::Controller<std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock, ableton::platforms::stl::Random, ableton::platforms::asio::Context<ableton::platforms::posix::ScanIpIfAddrs, ableton::util::NullLog, ableton::platforms::darwin::ThreadFactory> >::Controller(ableton::link::Tempo, std::__1::function<void (unsigned long)>, std::__1::function<void (ableton::link::Tempo)>, std::__1::function<void (bool)>, ableton::platforms::darwin::Clock)
#21 0x0000019b85945d in ableton::BasicLink<ableton::platforms::darwin::Clock>::BasicLink(double)
#22 0x0000019b8592bf in ableton::Link::Link(double)
#23 0x0000019b85894f in ableton::Link::Link(double)

Upon closer inspection it seems to be that the scheduler is null. I found a repo specifically for using Link in unity (https://github.com/comoc/UnityAbletonLink) and it works fine, but it seems like when I also include juce something goes horribly wrong. I verified this by taking the exports from the unity version repo, and compiling them with a Juce dynamic library, which crashes.

So was wondering if you'd come across anything like this (know it was 4 years ago) or had any idea where to start looking, I think it must be some xcode setting or preprocessor thats set that shouldnt be or vice versa, any advice at all is super appreciated! (I posted a similar issue on the ableton Link repo if there's any more info there, https://github.com/Ableton/link/issues/121)

MeijisIrlnd avatar Oct 04 '22 16:10 MeijisIrlnd