Error with VST2 compilation

I recently updated my Projucer on Ubuntu from a version 5 (which is what Ubuntu installs from APT) to the most recent version because I wanted access to all the version 6 functionality. But now I can’t compile VST2s due to an error compiling the Audio Plugin Client module. I would use VST3 but my DAW doesn’t support them yet. I have tried both an older VST3 SDK and a VST2.4 SDK but I get this same error regardless. AU and VST3 compilation works perfectly. Has anyone seen this before? Is there any work around? I have been googling it but couldn’t find anything so I came here. Thank you for your time!

/usr/bin/ld: build/intermediate/Debug/include_juce_audio_plugin_client_VST2_dd551e08.o: in function `JuceVSTWrapper::handleManufacturerSpecific(JuceVSTWrapper::VstOpCodeArguments)': /home/jasonb/JUCE/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp:1866: undefined reference to `juce::handleManufacturerSpecificVST2Opcode(int, long long, void*, float)' collect2: error: ld returned 1 exit status

juce::handleManufacturerSpecificVST2Opcode is defined in modules/juce_audio_plugin_client/utility/juce_PluginUtilities.cpp when JucePlugin_Build_VST is defined and true-ish (usually set to 1). So that linker error seems to mean that JucePlugin_Build_VST is not properly set to 1 by the build-system. What build system setup are you using? Projucer? The CMake support of JUCE 6? Something else/custom?

BTW, how are you getting the JUCE code? Still from apt, from the JUCE website, or from https://github.com/juce-framework/JUCE?

I downloaded the Juce code/projucer from the Juce website, I am using Makefile to compile, just by going into the directory the project creates and running make from command line. Do I just define that variable in my header or is it a parameter I pass to the build somehow? Thanks for the help!

JucePlugin_Build_VST should be set to 1 by Projucer when you enable the “VST (Legacy)” format. But you should have enabled it, since juce_audio_plugin_client_VST2 gets compiled… That’s puzzling :thinking:

Feel free to upload your Makefile (after giving it a .txt extension) if you want me to have a look.

Unfortunately since my account is new I can’t upload it (I am just a hobbyist right now and had no reason to make one until this). I can confirm that a “-DJucePlugin_Build_VST=1” is in the makefile though.

This took me an embarrassingly long amount of time to figure out but I thought I would write it down to save a potential future person the time. Basically, as I understand it (and I am not a C++ expert), if you don’t also build a VST3 version then VST3_REPLACEMENT_AVAILABLE can not be set which ultimately means that handleManufacturerSpecificVST2Opcode can not work correctly. You can get around it by either modifying handleManufacturerSpecificVST2Opcode to just return whatever you want or by simply building a VST3 along side and tossing it, which is what I am doing now.

Edit: Now that I have gotten it compiling I can compile it perfectly fine with the VST3 disabled. I don’t have time to figure out what is going on but I thought it was worth mentioning.