Still working on porting a plugin to OSX. I'm making it both as a VST-plugin and an Audio Unit.
I've been testing and debugging it in Ableton Live, steinbergs vsttesthost and Reaper in both 32 and 64-bit modes, where it works like a charm, both as Audio Unit and as VST (2.4). I then tried it in Logic, where it crashes the host (some seconds after succesful loading and UI showing).
I then tried it out it in JUCE PluginHost, with the following results:
Pluginhost crashes when scanning it as VST, and thus can't even test load it.
Pluginhost scans it without problems as Audio Unit, but crashes loading it.
Here are the relevant stack traces of the crashing threads (i tried debugging it while it crashed, but XCode just sends me to some unknown assembly saying EXC_BAD_ACCESS):
Logic when opening the plugin as Audio Unit:
Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000020 VM Regions Near 0x20: --> __TEXT 0000000107709000-000000010857f000 [ 14.5M] r-x/rwx SM=COW /Applications/Logic Pro X.app/Contents/MacOS/Logic Pro X Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libobjc.A.dylib 0x00007fff8c3d3f5e objc_release + 14 1 libobjc.A.dylib 0x00007fff8c3d3230 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 464 2 com.apple.CoreFoundation 0x00007fff8d28cd72 _CFAutoreleasePoolPop + 34 3 com.apple.Foundation 0x00007fff9205947a -[NSAutoreleasePool drain] + 154 4 com.apple.AppKit 0x00007fff8dfd227e -[NSApplication run] + 736 5 com.apple.AppKit 0x00007fff8df76bd6 NSApplicationMain + 869 6 com.apple.logic10 0x0000000107b8e6d9 0x107709000 + 4740825 7 com.apple.logic10 0x000000010770c044 0x107709000 + 12356
JUCE PluginHost when opening the plugin as Audio Unit:
Crashed Thread: 0 Juce Message Thread Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000020 VM Regions Near 0x20: --> __TEXT 000000010a67f000-000000010ad79000 [ 7144K] r-x/rwx SM=COW /Users/USER/Desktop/*/Plugin Host.app/Contents/MacOS/Plugin Host Thread 0 Crashed:: Juce Message Thread Dispatch queue: com.apple.main-thread 0 libobjc.A.dylib 0x00007fff8c3d3f5e objc_release + 14 1 libobjc.A.dylib 0x00007fff8c3d3230 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 464 2 com.apple.CoreFoundation 0x00007fff8d28cd72 _CFAutoreleasePoolPop + 34 3 com.apple.Foundation 0x00007fff9205947a -[NSAutoreleasePool drain] + 154 4 com.apple.AppKit 0x00007fff8dfd227e -[NSApplication run] + 736 5 com.rawmaterialsoftware.pluginhost 0x000000010a88b1a7 juce::MessageManager::runDispatchLoop() + 119 (juce_mac_MessageManager.mm:236) 6 com.rawmaterialsoftware.pluginhost 0x000000010a88b0b0 juce::JUCEApplicationBase::main() + 352 (juce_ApplicationBase.cpp:235) 7 com.rawmaterialsoftware.pluginhost 0x000000010a88aeec juce::JUCEApplicationBase::main(int, char const**) + 60 (juce_ApplicationBase.cpp:213) 8 com.rawmaterialsoftware.pluginhost 0x000000010a68f8a3 main + 51 (HostStartup.cpp:102) 9 libdyld.dylib 0x00007fff860c77e1 start + 1
JUCE PluginHost when scanning the plugin as VST 2.4:
Crashed Thread: 0 Juce Message Thread Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: EXC_I386_GPFLT Thread 0 Crashed:: Juce Message Thread Dispatch queue: com.apple.main-thread 0 libobjc.A.dylib 0x00007fff8c3d3f5e objc_release + 14 1 libobjc.A.dylib 0x00007fff8c3d3230 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 464 2 com.rawmaterialsoftware.pluginhost 0x000000010efbb1a2 juce::MessageQueue::deliverNextMessage() + 130 (juce_osx_MessageQueue.h:84) 3 com.rawmaterialsoftware.pluginhost 0x000000010efbb0ea juce::MessageQueue::runLoopCallback() + 58 (juce_osx_MessageQueue.h:90) 4 com.rawmaterialsoftware.pluginhost 0x000000010efbb0a5 juce::MessageQueue::runLoopSourceCallback(void*) + 21 (juce_osx_MessageQueue.h:100) 5 com.apple.CoreFoundation 0x00007fff8d26eb31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 6 com.apple.CoreFoundation 0x00007fff8d26e455 __CFRunLoopDoSources0 + 245 7 com.apple.CoreFoundation 0x00007fff8d2917f5 __CFRunLoopRun + 789 8 com.apple.CoreFoundation 0x00007fff8d2910e2 CFRunLoopRunSpecific + 290 9 com.apple.HIToolbox 0x00007fff90647eb4 RunCurrentEventLoopInMode + 209 10 com.apple.HIToolbox 0x00007fff90647c52 ReceiveNextEventCommon + 356 11 com.apple.HIToolbox 0x00007fff90647ae3 BlockUntilNextEventMatchingListInMode + 62 12 com.apple.AppKit 0x00007fff8dfdb533 _DPSNextEvent + 685 13 com.apple.AppKit 0x00007fff8dfdadf2 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128 14 com.apple.AppKit 0x00007fff8dfd21a3 -[NSApplication run] + 517 15 com.rawmaterialsoftware.pluginhost 0x000000010efac1a7 juce::MessageManager::runDispatchLoop() + 119 (juce_mac_MessageManager.mm:236) 16 com.rawmaterialsoftware.pluginhost 0x000000010efac0b0 juce::JUCEApplicationBase::main() + 352 (juce_ApplicationBase.cpp:235) 17 com.rawmaterialsoftware.pluginhost 0x000000010efabeec juce::JUCEApplicationBase::main(int, char const**) + 60 (juce_ApplicationBase.cpp:213) 18 com.rawmaterialsoftware.pluginhost 0x000000010edb08a3 main + 51 (HostStartup.cpp:102) 19 libdyld.dylib 0x00007fff860c77e1 start + 1
Another one from Logic Pro X
Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x00000005472d1ec8 VM Regions Near 0x5472d1ec8: __LINKEDIT 0000000201b74000-0000000201be3000 [ 444K] r--/rwx SM=COW /System/Library/Extensions/GeForceGLDriver.bundle/Contents/MacOS/GeForceGLDriver --> JS JIT generated code 00004b2881800000-00004b2881801000 [ 4K] ---/rwx SM=NUL Application Specific Information: objc_msgSend() selector name: dealloc Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libobjc.A.dylib 0x00007fff8c3cf259 objc_msgSend + 25 1 libobjc.A.dylib 0x00007fff8c3d3230 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 464 2 com.apple.CoreFoundation 0x00007fff8d28cd72 _CFAutoreleasePoolPop + 34 3 com.apple.Foundation 0x00007fff9205947a -[NSAutoreleasePool drain] + 154 4 com.apple.AppKit 0x00007fff8dfd227e -[NSApplication run] + 736 5 com.apple.AppKit 0x00007fff8df76bd6 NSApplicationMain + 869 6 com.apple.logic10 0x0000000105b956d9 0x105710000 + 4740825 7 com.apple.logic10 0x0000000105713044 0x105710000 + 12356
I can't really gather much from these traces (besides none show any stack frames from my plugin). I initially thought the problem to be in the module initialization, but i dont have any considerate statics/globals and i spawn no threads. But again, Logic does actually show the plugin UI and then crashes a couple of seconds later.
What they all have in common is crashing in this frame: (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 464
after sending a message (usually dealloc) to an Objective C-object. Now i dont directly use Objective-C objects anywhere in my code, but i guess they're a huge part of the codebase anyway.
I tried running it through auval, but it can't find the plugin (even though it is located in both /library/audio/plugins and /users/z/library/audio/plugins).
The weird thing is, of course, that the exact same binary works without problems in both ableton and reaper (oh and the same code works perfect on windows as VST as well). The plugin is 64-bit in this case (Logic doesn't support anything else). Any insight?