eyalamirmusic/JUCECmakeRepoPrototype

jassert (factory != nullptr) when loading vst3 in AudioPluginHost on Windows with clang-cl.exe compiler

Closed this issue · 6 comments

Running (debugging) the AudioPluginHost and let it look for the NewPluginTemplate vst3 disappoints and might hurt feelings.

Exception at
jassert (factory != nullptr);

juce_VST3PluginFormat.cpp line 869:

    {
        if (factory == nullptr)
            if (auto proc = (GetFactoryProc) getFunction ("GetPluginFactory"))
                factory = proc();

        // The plugin NEEDS to provide a factory to be able to be called a VST3!
        // Most likely you are trying to load a 32-bit VST3 from a 64-bit host
        // or vice versa.
        jassert (factory != nullptr);
        return factory;
    }```

Interesting, which platform are you on?

I'm using Windows 10 (x64) with latest greatest CLion.
Visual Studio Toolchain with bundled cmake using clang-cl.exe compiler (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\Llvm\bin\clang-cl.exe)

Created a Run/Debug Configuration from CMake Application Template with

  • Target: "NewPluginTemplate_VST3"
  • Executable "AudioPluginHost"

and I've set:
option(JUCE_BUILD_EXTRAS "Build JUCE Extras" ON) to get the AudioPluginHost

====================[ Build | NewPluginTemplate_VST3 | Debug ]==================
C:\Users\phili\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\201.7223.86\bin\cmake\win\bin\cmake.exe --build D:\D_Workspace\JUCECmakeRepoPrototype\cmake-build-debug --target NewPluginTemplate_VST3
[100%] Built target NewPluginTemplate
[100%] Built target NewPluginTemplate_VST3

Build finished

====================[ Build | AudioPluginHost | Debug ]=========================
C:\Users\phili\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\201.7223.86\bin\cmake\win\bin\cmake.exe --build D:\D_Workspace\JUCECmakeRepoPrototype\cmake-build-debug --target AudioPluginHost
[100%] Built target AudioPluginHost

Build finished

No problems with Visual Studio 2019:

  • File -> Open -> CMake...
  • CMake Targets View
  • build extras/AudioPluginHost (executable)
  • build NewPluginTemplate/NewPluginTemplate_All (utility target)
  • debug extras/AudioPluginHost (executable)
  • in Audio Plugin Host choose the directory of the built vst3 from the NewPluginTemplate built

the problem exists only with the clang-cl.exe compiler, with the cl.exe compiler (used in a CLion Toolchain) everything works fine.

So I don't need a resolution since I just use the cl.exe compiler from now on (or any other except clang-cl.exe out of the visual studio 2019 installation) for vst3

Thanks for reporting! We might need to pass it along to the JUCE team as this seems like Clang compatibility issue.
I only tested it very briefly on Windows, but seems like MSVC would be a better solution.

P.S - I’ve found that adding -G Ninja to the CMake flags in CLion improves compilation time significantly.

This has been fixed, closing it.