monadgroup / axiom

A powerful realtime node-based audio synthesizer.
Other
677 stars 31 forks source link

VST builds on macOS crash DAWs which scan them #146

Open remaininlight opened 5 years ago

remaininlight commented 5 years ago

When Ableton Live 10 or JUCE Plugin Host scan the directory containing the VST builds of Axiom they crash on my machine, I haven't tried any other hosts yet. When Ableton crashes it gives a message that Axiom VST 2 Effect.vst could not be loaded, here is a stack trace of that when it is run in a debugger:

__pthread_kill 0x00007fff7b9afb66
pthread_kill 0x00007fff7bb7a080
abort 0x00007fff7b90b1ae
QMessageLogger::fatal(char const*, ...) const 0x0000000143149bdd
QGuiApplicationPrivate::createPlatformIntegration() 0x0000000142c2f794
QGuiApplicationPrivate::createEventDispatcher() 0x0000000142c2f7bb
QCoreApplicationPrivate::init() 0x0000000143314658
QGuiApplicationPrivate::init() 0x0000000142c2aad9
QApplicationPrivate::init() 0x000000012e55c41a
AxiomApplication::AxiomApplication() AxiomApplication.cpp:25
AxiomApplication::AxiomApplication() AxiomApplication.cpp:25
AxiomCommon::LazyInitializer<AxiomApplication>::get() optional:319
AxiomCommon::LazyInitializer<AxiomApplication>::get() optional:818
AxiomCommon::LazyInitializer<AxiomApplication>::get() LazyInitializer.h:27
AxiomVstPlugin::AxiomVstPlugin(long long (*)(AEffect*, int, int, long long, void*, float)) AxiomVstPlugin.cpp:16
AxiomVstPlugin::AxiomVstPlugin(long long (*)(AEffect*, int, int, long long, void*, float)) AxiomVstPlugin.cpp:16
::VSTPluginMain(audioMasterCallback) AxiomVstPlugin.cpp:10

I don't seem to be able to get the QT source code to load in my debugger, so haven't gone much further. Neither plugin is visible to load in Ableton after this.

When JUCE Plugin Host scans the Axiom plugins it gives the following log:

Attempting to load VST: /Users/user/Bounce/groove-axiom/cmake-build-debug/editor/backend/vst2/Axiom VST2 Effect.vst
Creating VST instance: Axiom VST2 Effect
Using data path /Users/user/Library/Application Support/Axiom
Loading module library took 0.192188s
2018-11-07 23:36:10.615356+0000 AudioPluginHost[95826:8515891] QLayout: Attempting to add QLayout "" to AxiomGui::ModuleBrowserPanel "", which already has a layout
2018-11-07 23:36:10.615412+0000 AudioPluginHost[95826:8515891] QLayout: Attempting to add QLayout "" to AxiomGui::ModuleBrowserPanel "", which already has a layout
Patch took 0.003489216s
Codegen took 0.003489809s
Deploy took 0.004540505s
*** Unhandled VST Callback: 13
*** Unhandled VST Callback: 42
Initialising VST: Axiom VST2 Effect (1.0.0.0)
Attempting to load VST: /Users/user/Bounce/groove-axiom/cmake-build-debug/editor/backend/vst2/Axiom VST2 Instrument.vst
2018-11-07 23:36:12.294087+0000 AudioPluginHost[95826:8515891] Cannot find executable for CFBundle 0x7fe1f300b8f0 </Users/user/Bounce/groove-axiom/cmake-build-debug/editor/backend/vst2/Axiom VST2 Instrument.vst> (not loaded)

It then says that Axiom VST2 Instrument.vst did not load correctly. The Editor plugin loads and runs in JUCE Plugin Host but the Instrument is not visible.

Please advise how I should get Axiom running in Ableton and if there is any more information that would be useful to you.

remaininlight commented 5 years ago

Just noticed I get a different console message from Ableton:

2018-11-08 00:01:45.188 Live[96307:8535904] Live Version "10.0.5" with interface version: 4.8
2018-11-08 00:02:10.812559+0000 Live[96307:8535904] Cannot find executable for CFBundle 0x11c61f6b0 </Users/user/Bounce/groove-axiom/cmake-build-debug/editor/backend/vst2/Axiom VST2 Instrument.vst> (not loaded)
2018-11-08 00:02:10.812681+0000 Live[96307:8535904] Cannot find executable for CFBundle 0x11c61f6b0 </Users/user/Bounce/groove-axiom/cmake-build-debug/editor/backend/vst2/Axiom VST2 Instrument.vst> (not loaded)
objc[96307]: Class RunLoopModeTracker is implemented in both /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore (0x143635348) and /Applications/Ableton Live 10 Suite.app/Contents/Qt/lib/QtCore.framework/Versions/5/QtCore (0x14a22df30). One of the two will be used. Which one is undefined.
2018-11-08 00:02:12.830817+0000 Live[96307:8535904] QObject::moveToThread: Current thread (0x14201a9b0) is not the object's thread (0x7fffb4036380).
Cannot move to target thread (0x14201a9b0)
2018-11-08 00:02:12.830844+0000 Live[96307:8535904] You might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.
2018-11-08 00:02:12.830910+0000 Live[96307:8535904] [qt.qpa.plugin] Could not load the Qt platform plugin "cocoa" in "" even though it was found.
2018-11-08 00:02:12.830937+0000 Live[96307:8535904] This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: cocoa.
Signal: SIGABRT (signal SIGABRT)

Looks like this might be my setup "loading two sets of Qt binaries into the same process"? Not sure what this means.. I installed Qt with brew and am using these CMake options for the build:

-DVST2_SDK_ROOT=/Users/user/Bounce/sdks/vst-2.4 -DCMAKE_PREFIX_PATH="/usr/local/opt/qt;/usr/local/opt/llvm@6"

cpdt commented 5 years ago

Hey, thanks for reporting the issue! It's good to have someone testing this on Mac, since I only have a limited ability to do that 😄

The Ableton issue looks like it's trying to load the Qt binaries from two different locations (one in /local/opt/qt and one in Ableton), which ends up conflicting weirdly. I'm not familiar enough with macOS bundling to know what the correct fix for this is (i.e how to tell it which one to load), but if you run make package it should generate a VST bundle with Qt included inside, which should work at least.

I think I know what's happening with the JUCE Plugin Host - the instrument and effect have the same plugin IDs. That should be pretty easy to fix, I'll make a patch.

cpdt commented 5 years ago

@remaininlight Are you able to try the latest master and let me know if that fixes the JUCE host problem?

remaininlight commented 5 years ago

It's a pleasure to explore Axiom, thanks for sharing! + Apologies for being the bearer of annoying incompatibility issues :D

Unfortunately JUCE Host is still only loading the VST2 Effect:

Attempting to load VST: /Users/user/Bounce/groove-axiom/cmake-build-debug/editor/backend/vst2/Axiom VST2 Instrument.vst
2018-11-08 16:42:28.866588+0000 AudioPluginHost[16434:146155] Cannot find executable for CFBundle 0x7fe77d0907b0 </Users/user/Bounce/groove-axiom/cmake-build-debug/editor/backend/vst2/Axiom VST2 Instrument.vst> (not loaded)

Running in Ableton continues to be uncooperative, Ableton loads its own version of Qt which is packaged with it and conflicts with Axiom's Qt, so this is likely to be an issue for anyone using Axiom with Ableton on Mac (if not Windows?).

"$ make package" doesn't do anything for me, I get:

make: *** No rule to make target `package'.  Stop.

When I try the static build for VST:

cmake ../path/to/source -DAXIOM_STATIC_LINK=ON -DVST2_SDK_ROOT=/path/to/vst/sdk
cmake --build ./ --target axiom_vst2_instrument

I get:

Undefined symbols for architecture x86_64:
  "qt_static_plugin_QCocoaIntegrationPlugin()", referenced from:
      StaticQCocoaIntegrationPluginPluginInstance::StaticQCocoaIntegrationPluginPluginInstance() in libaxiom_editor.a(AxiomApplication.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [editor/backend/vst2/Axiom VST2 Instrument.vst/Contents/MacOS/Axiom VST2 Instrument] Error 1
make[2]: *** [editor/backend/vst2/CMakeFiles/axiom_vst2_instrument.dir/all] Error 2
make[1]: *** [editor/backend/vst2/CMakeFiles/axiom_vst2_instrument.dir/rule] Error 2
make: *** [axiom_vst2_instrument] Error 2

I thought of linking Axiom with Ableton's Qt but this seems like a bad idea, investigated Qt's namespaces (https://wiki.qt.io/Qt_In_Namespace) but it seems like you would have to build a new version of Qt specifically for Axiom namespace anyway, so static linking would probably be preferable if you've got any ideas about getting it working?

remaininlight commented 5 years ago

Also, just to note that when Axiom VST Effect.vst is not present the Instrument still doesn't load, so nice guess with the plugin ids but doesn't look like it's a conflict.

cpdt commented 5 years ago

Hmm, that loading issue is... interesting. The compiled bundle should be exactly the same except for a small preprocessor bit in AxiomVstPlugin.cpp, which only changes the ID and calls isSynth for the instrument. In the build script they're both built with identical calls to add_backend, but maybe there's some weird CMake statefulness going on? Are there any obvious differences to the file structure inside the instrument and effect bundles?

Regarding static linking, it looks like it needs to be explicitly linked to Qt's Cocoa plugin. This is meant to be fixed with the Q_IMPORT_PLUGIN macro, which we already use, so I'm not really sure why that error is still coming up.

For make package I just realised you'll need to pass in -DDEPLOY=ON to CMake to generate that target. It's for building installers with CPack, but as a side effect it runs the install scripts which involves packaging Qt binaries with the bundle. Running make install will do the same thing, but it'll install the packaged bundles to your system somewhere (you can pass -DCMAKE_INSTALL_PREFIX=... to cmake to tell it to go somewhere else).

remaininlight commented 5 years ago

149