CMake: You need to enable at least one plugin format

Hello,

I’m trying to crosscompile a VST3 plugin on Ubuntu 20.04 with vanilla mingw64.

The plugin compiles and runs fine when compiled for Linux VST3, but when crosscompiling for Windows it seems that some macro is lost generated by the magic “juce_add_plugin” function is lost.

//win-release-build/_deps/juce-src/modules/juce_audio_plugin_client/utility/…/utility/juce_CheckSettingMacros.h:34:3: error: #error “You need to enable at least one plugin format!”
34 | #error “You need to enable at least one plugin format!”

My target looks like this:

juce_add_plugin(
    ${target}
    PLUGIN_MANUFACTURER_CODE ArtV
    PLUGIN_CODE Mmt${channels}
    PRODUCT_NAME ${target}
    COMPANY_NAME ArtV
    VERSION "${MIXMAXTRIX_VERSION}"
    FORMATS VST3
    NEEDS_MIDI_INPUT 0
    VST_NUM_MIDI_INS 0
    )

And it has some defines afterwards:

target_compile_definitions(
    ${target}
    PUBLIC
    JUCE_WEB_BROWSER=0
    JUCE_USE_CURL=0
    JUCE_VST3_CAN_REPLACE_VST2=0
    JUCER_ENABLE_GPL_MODE=1
    )

Any ideas?

I forgot to add the CMake toolchain file I’m using, but it’s nothing out of the ordinary, I’m setting the compilers/utils and CMAKE_SYSTEM_NAME “Windows”, CMAKE_SYSTEM_PROCESSOR “x86_64”, etc. Regular procedure.

I can clearly see on the command line how the VST3 setting is ignored at the CMake level. Notice the “-DJucePlugin_Build_VST3=0”.

/usr/bin/x86_64-w64-mingw32-g+±posix -DFF_AUDIO_ALLOW_ALLOCATIONS_IN_MEASURE_BLOCK=0 -DJUCER_ENABLE_GPL_MODE=1 -DJUCE_DISPLAY_SPLASH_SCREEN=0 -DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1 -DJUCE_MODULE_AVAILABLE_juce_audio_basics=1 -DJUCE_MODULE_AVAILABLE_juce_audio_devices=1 -DJUCE_MODULE_AVAILABLE_juce_audio_formats=1 -DJUCE_MODULE_AVAILABLE_juce_audio_processors=1 -DJUCE_MODULE_AVAILABLE_juce_audio_utils=1 -DJUCE_MODULE_AVAILABLE_juce_core=1 -DJUCE_MODULE_AVAILABLE_juce_data_structures=1 -DJUCE_MODULE_AVAILABLE_juce_events=1 -DJUCE_MODULE_AVAILABLE_juce_graphics=1 -DJUCE_MODULE_AVAILABLE_juce_gui_basics=1 -DJUCE_MODULE_AVAILABLE_juce_gui_extra=1 -DJUCE_SHARED_CODE=1 -DJUCE_STANDALONE_APPLICATION=JucePlugin_Build_Standalone -DJUCE_USE_CURL=0 -DJUCE_USE_SSE_INTRINSICS=1 -DJUCE_VST3_CAN_REPLACE_VST2=0 -DJUCE_WEB_BROWSER=0 -DJucePlugin_AAXCategory=0x00000000 -DJucePlugin_AAXDisableBypass=0 -DJucePlugin_AAXDisableMultiMono=0 -DJucePlugin_AAXIdentifier=com.ArtV.mix-maxtrix-4 -DJucePlugin_AAXManufacturerCode=JucePlugin_ManufacturerCode -DJucePlugin_AAXProductId=JucePlugin_PluginCode -DJucePlugin_AUExportPrefix=mix_maxtrix_4AU -DJucePlugin_AUExportPrefixQuoted=“mix_maxtrix_4AU” -DJucePlugin_AUMainType="‘aufx’" -DJucePlugin_AUManufacturerCode=JucePlugin_ManufacturerCode -DJucePlugin_AUSubType=JucePlugin_PluginCode -DJucePlugin_Build_AAX=0 -DJucePlugin_Build_AU=0 -DJucePlugin_Build_AUv3=0 -DJucePlugin_Build_Standalone=0 -DJucePlugin_Build_Unity=0 -DJucePlugin_Build_VST3=0 -DJucePlugin_Build_VST=0 -DJucePlugin_CFBundleIdentifier=com.ArtV.mix-maxtrix-4 -DJucePlugin_Desc=“mix-maxtrix-4” -DJucePlugin_EditorRequiresKeyboardFocus=0 -DJucePlugin_IsMidiEffect=0 -DJucePlugin_IsSynth=0 -DJucePlugin_Manufacturer=“ArtV” -DJucePlugin_ManufacturerCode=0x41727456 -DJucePlugin_ManufacturerEmail="" -DJucePlugin_ManufacturerWebsite="" -DJucePlugin_Name=“mix-maxtrix-4” -DJucePlugin_PluginCode=0x4d6d7434 -DJucePlugin_ProducesMidiOutput=0 -DJucePlugin_VSTCategory=kPlugCategEffect -DJucePlugin_VSTNumMidiInputs=0 -DJucePlugin_VSTNumMidiOutputs=16 -DJucePlugin_VSTUniqueID=JucePlugin_PluginCode -DJucePlugin_Version=0.0.1 -DJucePlugin_VersionCode=0x1 -DJucePlugin_VersionString=“0.0.1” -DJucePlugin_Vst3Category=“Fx” -DJucePlugin_WantsMidiInput=0 -DMIXMAXTRIX_CHANNELS=4 -DNDEBUG=1 -DVERSION_MAJOR=0 -DVERSION_MINOR=0 -DVERSION_REV=1 -DVERSION_TXT=“0.0.1” -D_NDEBUG=1 @CMakeFiles/mix-maxtrix-4.dir/includes_CXX.rsp -O3 -DNDEBUG -fvisibility=hidden -fno-keep-inline-dllexport -Wa,-mbig-obj -std=gnu++17 -o CMakeFiles/mix-maxtrix-4.dir/_deps/juce-src/modules/juce_audio_utils/juce_audio_utils.cpp.obj -c /win-release-build/_deps/juce-src/modules/juce_audio_utils/juce_audio_utils.cpp

On JUCE’s Cmake, it seems that crosscompiling VST3 is explicitly disabled:

function(_juce_get_platform_plugin_kinds out)
set(result Standalone)

if(APPLE AND (CMAKE_GENERATOR STREQUAL "Xcode"))
    list(APPEND result AUv3)
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
    list(APPEND result AU)
endif()

if(NOT CMAKE_SYSTEM_NAME STREQUAL "iOS" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
    list(APPEND result AAX Unity VST)

    if(NOT MINGW AND NOT MSYS)
        list(APPEND result VST3)
    endif()
endif()

set(${out} ${result} PARENT_SCOPE)

endfunction()

You might have very valid reasons to do not support mingw, but I’d have appreciated a loud and clear error saying that what I’m trying to do is not possible, as VST3 is a format supported on Windows.

Although VST3 is supported on Windows, I don’t think the VST3 SDK supports compilation with MinGW. The version included in JUCE definitely didn’t the last time I checked.

It’s a good idea to generate a warning in this case. I’ll see what we can do there.

Thanks for the info, that’s good to know. I’ll see whether I can get this working.

Thanks!

Just out of curiosity, I tried to crosscompile with mingw on the LV2 fork (GitHub - lv2-porting-project/JUCE: The JUCE cross-platform C++ framework), as for my purposes LV2 is enough; I just want to sanity check on “wine/Reaper” while I develop on Linux and at some point before I make the plugins public just start sanity checking on Windows. I don’t like to develop on Windows.

With the LV2 fork I get:
/home/s0001192/oss/gogue/win-release-build/_deps/juce-src/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp:235:17: error: ‘IUnknown_GetWindow’ was not declared in this scope
235 | IUnknown_GetWindow (d, &hwnd);

Which now is not a problem of the code, but the mingw project, as it seems that the missing definitions were just added three weeks ago:
https://www.mail-archive.com/mingw-w64-public@lists.sourceforge.net/msg18584.html

I desist, I will be doing a big-bang on Windows at the end…

I think I fixed that issue in a10cc6faffcf, but it’s possible the fork you’re using is based on an old copy of JUCE.

1 Like

I spent some time looking at this today. It looks like the newest version of the VST3 SDK (3.7.2 at time of writing) builds cleanly with MinGW 8.1, and doesn’t require the extra definitions or -fpermissive. I think we’ll likely update the version of the VST3 SDK bundled with JUCE, and enable VST3/MinGW builds in CMake.

1 Like

Very good news. Cool to know that at some point dealing with Visual Studio and Windows CI might be avoided, thanks a lot!

Hi, getting an issue building vst3 on mingw:

MIDISynth-Peak_VST3.vcxproj → C:\Users\leehu\dev\cpp\JUCE\Projects\MIDISynth\App\Nov\Peak\cmake-build\MIDISynth-Peak_artefacts\Debug\VST3\MIDISynth-Peak.vst3\Contents\x86_64-win\MIDISynth-Peak.vst3
‘attrib’ is not recognized as an internal or external command,

Seems ok if I use standard command line. thx

Normally MinGW/CMake errors that include is not recognized as an internal or external command indicate that there are incorrectly-escaped characters in the build commands. I’d recommend inspecting the problematic build command to check if there’s anything unexpected near the attrib token. You could also try using a different generator (e.g. Ninja), and/or running from a different shell (e.g. powershell/cmd/git-bash) to see whether that has any effect.

1 Like

thx @reuk

i’m trying to create scripts that run on mac and windows so that’s why I’m using git-bash.
cmd and powershell deal with the vst3 ok, but can’t run shell scripts.

so, how do I investigate further the “incorrectly-escaped” characters?
thx

To investigate, you need to look at the actual commands that are being executed by the build system. You can use CMake’s --verbose option to display the build commands as they run.

You also need to make sure that your chosen generator is compatible with your shell. MinGW Makefiles are only compatible with Windows command prompts, so I wouldn’t expect them to work correctly under git-bash.

1 Like

ok, thx @reuk will check them out - honestly though, the only problem is the vst3 - everything else works like a charm.

@reuk so there’s a difference between whats emmitted for post-build step on the vst and vst3, maybe becuase it’s a directory?
3>PostBuildEvent:
setlocal
“C:\Program Files\CMake\bin\cmake.exe” -Dsrc=C:/Users/leehu/dev/cpp/JUCE/Projects/MIDISynth/App/Nov/Peak/cmake-build/MIDISynth-Peak_artefacts/Debug/VST/MIDISynth-Peak.dll -Ddest=c:/Users/leehu/dev/cpp/bin/vst64 -P C:/Users/leehu/dev/JUCE/lib/cmake/JUCE-7.0.2/copyDir.cmake
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
:VCEnd
4>PostBuildEvent:
setlocal
“C:\Program Files\CMake\bin\cmake.exe” -E copy C:/Users/leehu/dev/cpp/JUCE/Projects/MIDISynth/App/Nov/Peak/cmake-build/MIDISynth-Peak_artefacts/JuceLibraryCode/icon.ico C:/Users/leehu/dev/cpp/JUCE/Projects/MIDISynth/App/Nov/Peak/cmake-build/MIDISynth-Peak_artefacts/Debug/VST3/MIDISynth-Peak.vst3/Plugin.ico
if %errorlevel% neq 0 goto :cmEnd
attrib +s C:/Users/leehu/dev/cpp/JUCE/Projects/MIDISynth/App/Nov/Peak/cmake-build/MIDISynth-Peak_artefacts/Debug/VST3/MIDISynth-Peak.vst3/desktop.ini
if %errorlevel% neq 0 goto :cmEnd
attrib +s C:/Users/leehu/dev/cpp/JUCE/Projects/MIDISynth/App/Nov/Peak/cmake-build/MIDISynth-Peak_artefacts/Debug/VST3/MIDISynth-Peak.vst3
“C:\Program Files\CMake\bin\cmake.exe” -Dsrc=C:/Users/leehu/dev/cpp/JUCE/Projects/MIDISynth/App/Nov/Peak/cmake-build/MIDISynth-Peak_artefacts/Debug/VST3/MIDISynth-Peak.vst3 -Ddest=c:/Users/leehu/dev/cpp/bin/vst64/vst3 -P C:/Users/leehu/dev/JUCE/lib/cmake/JUCE-7.0.2/copyDir.cmake

so, the attribs fail and then the final copy to install the vst3 doesn’t execute, so it’s all there, just post build step failing.

executing the two above attrib commands work fine.

@reuk, is there any way to get the cmake vst3 to just emit the single file, i’ve got a feeling that would cure the situation. thx