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.

I have been using VST3 with mingw since January 2020
https://kx.studio/News/?action=view&url=carla-21-rc1-is-here

It builds but needs a little forcing.
Specifically:

-D_NATIVE_WCHAR_T_DEFINED -D__wchar_t=wchar_t -fpermissive -Wno-unknown-pragmas

EDIT: Actually was using it before that. So it has been sorta compatible for a while.

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

Look into DISTRHO-Ports/libs/juce-current/patches at master · DISTRHO/DISTRHO-Ports · GitHub to see if anything relevant for you.
I need to disable a few things in JUCE to get mingw builds working.
I assume the JUCE dev team has the absolute latest mingw, but we do not.

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!