Build error when adding juce module

Hi,

My plugin used to build fine when not using the juce dsp module. When i add the juce dsp module to my project it fails to build. This is the error:

FAILED: PhaseDistortion_artefacts/Release/VST3/Phase Distortion.vst3/Contents/x86_64-win/Phase Distortion.vst3
removing moduleinfo.json
ninja: build stopped: subcommand failed.

i am using CMake and use juce_generate_juce_header. I include the header in the header file that i want to use the juce module in. I also link to the juce::juce_dsp module.

target_link_libraries(${PROJECT_NAME}
        PRIVATE
        # AudioPluginData           # If we'd created a binary data target, we'd link to it here
        PUBLIC
        juce::juce_dsp
        juce::juce_audio_utils
        juce::juce_audio_plugin_client
        juce::juce_recommended_config_flags
        juce::juce_recommended_lto_flags
        juce::juce_recommended_warning_flags)

JUCE version: 7.0.10
CMake version 3.26.0-rc2
Generator: Ninja
Toolchain: Visual Studio

Given the information you’ve supplied it’s hard to say what the issue is, maybe if you can start by sharing a bit more of the build log?

The fact that in the small amount of logs you have shared, it says “removing moduleinfo.json” I’m thinking that there may be a problem while generating the VST3 module info.

When generating the file it will load your plugin so if for example your plugin crashes on start up then your plugin will fail to build.

If your .vst3 is still in the artefacts directory can you try installing it and seeing if it loads in a DAW or the AudioPluginHost?

Thanks for your help.

The build log doesn’t really show a lot. Below is my full build log. It seems like everything builds fine, also the juce_dsp module.

The plugin crashes immediately when loaded in a DAW. The moduleinfo.json is actually not removed but it’s just completely empty.

====================[ Build | PhaseDistortion_VST3 | Debug ]====================
"C:\Program Files\JetBrains\CLion 2023.1.2\bin\cmake\win\x64\bin\cmake.exe" --build C:\Users\####\Documents\####\Projects\PhaseDistortion\cmake-build-debug --target PhaseDistortion_VST3 -j 14
[0/2] Re-checking globbed directories...
[1/22] Building CXX object CMakeFiles\PhaseDistortion.dir\lib\JUCE\modules\juce_core\juce_core_CompilationTime.cpp.obj
[2/22] Building CXX object CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_audio_processors\juce_audio_processors_lv2_libs.cpp.obj
[3/22] Building CXX object CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_core\juce_core_CompilationTime.cpp.obj
[4/22] Building CXX object CMakeFiles\PhaseDistortion.dir\lib\JUCE\modules\juce_data_structures\juce_data_structures.cpp.obj
[5/22] Building CXX object CMakeFiles\PhaseDistortion.dir\lib\JUCE\modules\juce_events\juce_events.cpp.obj
[6/22] Building CXX object CMakeFiles\PhaseDistortion.dir\lib\JUCE\modules\juce_audio_basics\juce_audio_basics.cpp.obj
[7/22] Building CXX object CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_audio_processors\juce_audio_processors_ara.cpp.obj
[8/22] Building CXX object CMakeFiles\PhaseDistortion.dir\lib\JUCE\modules\juce_dsp\juce_dsp.cpp.obj
[9/22] Building CXX object CMakeFiles\PhaseDistortion.dir\lib\JUCE\modules\juce_audio_formats\juce_audio_formats.cpp.obj
[10/22] Building CXX object CMakeFiles\PhaseDistortion.dir\src\PluginEditor.cpp.obj
[11/22] Building CXX object CMakeFiles\PhaseDistortion.dir\lib\JUCE\modules\juce_audio_devices\juce_audio_devices.cpp.obj
[12/22] Building CXX object CMakeFiles\PhaseDistortion.dir\src\PluginProcessor.cpp.obj
[13/22] Building CXX object CMakeFiles\PhaseDistortion.dir\lib\JUCE\modules\juce_audio_utils\juce_audio_utils.cpp.obj
[14/22] Building CXX object CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_gui_extra\juce_gui_extra.cpp.obj
[15/22] Building CXX object CMakeFiles\PhaseDistortion.dir\lib\JUCE\modules\juce_core\juce_core.cpp.obj
[16/22] Building CXX object CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_core\juce_core.cpp.obj
[17/22] Linking CXX static library "PhaseDistortion_artefacts\Debug\Phase Distortion_SharedCode.lib"
[18/22] Building CXX object CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_audio_utils\juce_audio_utils.cpp.obj
[19/22] Building CXX object CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_audio_processors\juce_audio_processors.cpp.obj
[20/22] Building CXX object CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_graphics\juce_graphics_Harfbuzz.cpp.obj
[21/22] Building CXX object CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_gui_basics\juce_gui_basics.cpp.obj
[22/22] Linking CXX shared module "PhaseDistortion_artefacts\Debug\VST3\Phase Distortion.vst3\Contents\x86_64-win\Phase Distortion.vst3"
FAILED: PhaseDistortion_artefacts/Debug/VST3/Phase Distortion.vst3/Contents/x86_64-win/Phase Distortion.vst3 
cmd.exe /C "cd . && "C:\Program Files\JetBrains\CLion 2023.1.2\bin\cmake\win\x64\bin\cmake.exe" -E vs_link_dll --intdir=CMakeFiles\PhaseDistortion_VST3.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~4\2022\COMMUN~1\VC\Tools\MSVC\1434~1.319\bin\Hostx64\x64\link.exe /nologo CMakeFiles\PhaseDistortion_rc_lib.dir\PhaseDistortion_artefacts\JuceLibraryCode\PhaseDistortion_resources.rc.res CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_audio_utils\juce_audio_utils.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_audio_processors\juce_audio_processors.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_audio_processors\juce_audio_processors_ara.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_audio_processors\juce_audio_processors_lv2_libs.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_gui_extra\juce_gui_extra.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_gui_basics\juce_gui_basics.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_graphics\juce_graphics.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_graphics\juce_graphics_Harfbuzz.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_events\juce_events.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_core\juce_core.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_core\juce_core_CompilationTime.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_data_structures\juce_data_structures.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_audio_basics\juce_audio_basics.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_audio_formats\juce_audio_formats.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_audio_devices\juce_audio_devices.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_dsp\juce_dsp.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_audio_plugin_client\juce_audio_plugin_client_AAX.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_audio_plugin_client\juce_audio_plugin_client_AAX_utils.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_audio_plugin_client\juce_audio_plugin_client_ARA.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_audio_plugin_client\juce_audio_plugin_client_LV2.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_audio_plugin_client\juce_audio_plugin_client_Standalone.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_audio_plugin_client\juce_audio_plugin_client_Unity.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_audio_plugin_client\juce_audio_plugin_client_VST2.cpp.obj CMakeFiles\PhaseDistortion_VST3.dir\lib\JUCE\modules\juce_audio_plugin_client\juce_audio_plugin_client_VST3.cpp.obj  /out:"PhaseDistortion_artefacts\Debug\VST3\Phase Distortion.vst3\Contents\x86_64-win\Phase Distortion.vst3" /implib:"PhaseDistortion_artefacts\Debug\VST3\Phase Distortion.lib" /pdb:"PhaseDistortion_artefacts\Debug\VST3\Phase Distortion.pdb" /dll /version:0.0 /machine:x64 /debug /INCREMENTAL  "PhaseDistortion_artefacts\Debug\Phase Distortion_SharedCode.lib"  PhaseDistBinaryData.lib  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib  && cmd.exe /C "cd /D C:\Users\####\Documents\####\Projects\PhaseDistortion\cmake-build-debug && "C:\Program Files\JetBrains\CLion 2023.1.2\bin\cmake\win\x64\bin\cmake.exe" -E echo "removing moduleinfo.json" && "C:\Program Files\JetBrains\CLion 2023.1.2\bin\cmake\win\x64\bin\cmake.exe" -E remove -f "C:/Users/####/Documents/####/Projects/PhaseDistortion/cmake-build-debug/PhaseDistortion_artefacts/Debug/VST3/Phase Distortion.vst3/Contents/moduleinfo.json" "C:/Users/####/Documents/####/Projects/PhaseDistortion/cmake-build-debug/PhaseDistortion_artefacts/Debug/VST3/Phase Distortion.vst3/Contents/Resources/moduleinfo.json" && cd /D C:\Users\####\Documents\####\Projects\PhaseDistortion\cmake-build-debug && "C:\Program Files\JetBrains\CLion 2023.1.2\bin\cmake\win\x64\bin\cmake.exe" -E make_directory "C:/Users/####/Documents/####/Projects/PhaseDistortion/cmake-build-debug/PhaseDistortion_artefacts/Debug/VST3/Phase Distortion.vst3/Contents/Resources" && C:\Users\####\Documents\####\Projects\PhaseDistortion\cmake-build-debug\juce_vst3_helper.exe -create -version 0.1.0 -path "C:/Users/####/Documents/####/Projects/PhaseDistortion/cmake-build-debug/PhaseDistortion_artefacts/Debug/VST3/Phase Distortion.vst3" -output "C:/Users/####/Documents/####/Projects/PhaseDistortion/cmake-build-debug/PhaseDistortion_artefacts/Debug/VST3/Phase Distortion.vst3/Contents/Resources/moduleinfo.json" && cd /D C:\Users\####\Documents\####\Projects\PhaseDistortion\cmake-build-debug && "C:\Program Files\JetBrains\CLion 2023.1.2\bin\cmake\win\x64\bin\cmake.exe" "-Dsrc=C:/Users/####/Documents/####/Projects/PhaseDistortion/cmake-build-debug/PhaseDistortion_artefacts/Debug/VST3/Phase Distortion.vst3" "-Ddest=C:\Program Files\Common Files/VST3" -P C:/Users/####/Documents/####/Projects/PhaseDistortion/lib/JUCE/extras/Build/CMake/copyDir.cmake""
removing moduleinfo.json
ninja: build stopped: subcommand failed.

Thanks.

This is your problem, you’ll need to attach a debugger and debug the issue. Once the plugin loads the module info file should generate correctly and your builds will pass again.

I can’t remember for sure but it might be removing a temporary moduleinfo.json file so as not to leave one possibly half written in the plugin bundle.

1 Like

It’s solved! I attached a debugger and noticed that i hit an assertion somewhere in the juce_dsp code. That’s why the plugin crashed.

Normally i would see a popup when i hit an assertion or in release mode, the plugin would just build.Strange that that did not happen now. But anyway, it’s working now. Thanks for the help :slight_smile:

So the plugin did build but during the post build script it tried to generate the moduleinfo.json, in order to generate it, it must load the plugin, but as there was an assertion it failed and so you saw the error in your build log.

If the assertion doesn’t happen as soon as the plugin is inserted it should be fine.

I think I just hit this as well. Is there any way to get a better error message when this happens? As it is, I think it gives the impression there is a problem with the building rather than the running.

@AdamVenn it’s something we plan to explore, I think we’ll likely try to let the build continue with a warning. I think I had this working in a PoC for the Projucer but I hadn’t yet got there for CMake.

1 Like