CMake and CLion: executable and debug issue

Hi all!

I am newbie to CMake and I am trying to switch my project from Projucer to CMake.

I set up my CMakeLists.txt file and everything works fine with the standard cmake commands from my terminal. However, I would like to use my CLion IDE to build release and debug versions of my plugin, but every time I try to run my debug or release build, it fails because of missing executable. Could I build my (release) project without adding an ‘executable’?

Up to now the two debug and release builds differ for the -DCMAKE_BUILD_TYPE option. Is this difference the same between the Projucer Release and Debug builds? And how could I debug my plugin in CLion by adding breakpoints?
Up to now I tried to add an executable to my debug build (Ableton Live in my case) and a breakpoint to a line of code. However every time I click on the debug button, Ableton opens up but on my breakpoint I read this:

The breakpoint will not currently be hit. No executable code is associated with this line.

Thank you for your helps :slight_smile:

1 Like

Hi karota,

Based on how I interpret what you wrote, it sounds like you are not building your plugins. CMake ‘builds’ the projects. You need to use those projects to build your plugins.

You may want to give a more detailed set of steps you are taking so people can better understand what you are doing vs. what you want to do. Also, tell which os and any other information that will help the forum understand what you are doing.

1 Like

Hi @anoesisaudio and sorry if my post could appear incomplete.

First of all, I am working on MacOs Catalina 10.15.7 Intel-based.

I knew about the fact that with CMake I firstly need to build project and my steps from command line were:
(in the folder of project, where the CMakeLists.txt file is located)

  • cmake -B <destination_folder_path>
  • cmake -build <destination_folder_path> -config Release (or Debug)

everything seems to work fine.

When I load my project in CLion, I can build my project and then I can run it.
The build of the project works fine and I see two destination folders (cmake-build-release and cmake-build-debug)
However when I run or debug the project (in Release or Debug configuration), CLion generates an error, which is ‘Executable not specified’

Secondly, I would like to understand how to debug my plugin inside CLion. Because I tried to do it by selecting the Debug build and adding an executable (Ableton). However the breakpoints are not triggered in this way when I load my plugin in the DAW (Ableton)

Hope that this reply is more complete and still thanks :slight_smile:

Hi karota,

No need to apologize. :slight_smile: The additional information should make it easier for others to understand what you are trying to do.

Of course, I don’t really use CLion (aside from building on linux very occasionally), but I will try to provide some information here. Others will surely be able to help too.

Finding the executable & Debugging with Ableton

From what you said, it does not sound like you have a problem with your exporter for CLion.

Since you are on mac, your plugins should be in the ‘normal’ folders… /Users/yourname/Library/Audio/Plug-Ins. If they are not there, in your CMakeLists file, you check if what I show below is set.


CLion debugging basics - this video shows how to connect your project to a DAW like Ableton.

This video has a bit more general debugging info.

Sorry I don’t know much on this topic - I hope it helps!

1 Like

Debugging plugins in mac clion is pretty straight forward once you are set up but as you are seeing that first setup is tricky. The way I do it usually is to enable the standalone and run that most of the time which lets me test DSP UI and so on - but I’m primarily working on a synth not an effect. So if you are building a VST3 or an AU you need to configure CLion to launch a host which will then load your plugin.

as @anoesisaudio said, COPY_PLUGIN_AFTER_BUILD TRUE is super important. Without that the plugin won’t install locally. But it’s still not runnable as you saw.

So for your VST3, in CLion go to configurations dropdown and choose ‘edit configurations’ then choose a runtime. Here’s the Surge VST3 which is set - when I run it - to launch reaper.

That will just launch reaper with your last reaper session. But reaper takes a .rpp file as an argument so if you want you can create a reaper file which loads your plug, save it to desktop, then make program arguments “/Users/You/Desktop/ThatThing.rpp” or what not

So the only question then is which hosts are good to debug in. For VST3 I use reaper primarily for debugging. For AU you can debug in logic this way but logic is slow to start; I use the really useful Hosting AU (Hosting AU) if I want a tiny lightweight AU host and it also does the thing where the program arg is the startup patch.

There’s a load of other ways, but for Surge, I’ve found do most of my debugging in the standalone then iterate in HAU and Reaper until it works then go test with (everything else) is a workflow that works and works great in CLion.

1 Like

With CLion you don’t need to use any CMake command line stuff. Just open the CMakeLists.txt directly in CLion and build/debug from there without ever calling CMake directly.

The simplest to get working is the standalone target.

1 Like

Hi @anoesisaudio , @baconpaul and @eyalamir !

Thank you very much for your replies! Everything was solved by that flag! :slight_smile:

For @baconpaul : might I ask you if with Hosting AU it’s possible to debug also the plugin during the validation?

Up to now I have a released AU plugin which passes all the pluginval tests but fails on au validation. When I set my local copy of auvaltool as executable of my plugin, as soon as I run my debug AU build I get always the following issue:

process exited with status -1 (Error 1)

and I can’t debug my crashed validation. Could you please help me?

Still thanks

Oh I vaguely remember that from eons ago. There’s something odd about auval and debugging.

If I recall I had to copy /usr/bin/auval to somewhere in my home directory then use the copied executable. And now I recall it was another thread on this forum which let me do it. How to debug auval? - #4 by daniel seems to be what you need?

Oh yes! I already checked that thread!

I copied my auvaltool, renamed it, added as executable in the debug mode but I always get this:

Edit: obviously I add some breakpoints in the code, also in the constructor of my PluginProcessor

Hi karota,

For what it is worth, I don’t set auval as an executable, but rather call it from the command prompt like (for an effects plug):

auval -v aufx <plugcode> <plugmanufacturercode> &> $HOME/Library/Audio/Plug-Ins/Components/auval_<plugname>.txt

This will generate a file showing the output of the auval run in addition to showing that output in the terminal. You would need to replace the <> items with things from your CMakeLists file.

<plugcode> with PLUGIN_CODE <this>
<plugmanufacturercode> with PLUGIN_MANUFACTURER_CODE <this>
<plugname> with PRODUCT_NAME <this>
1 Like

Thank you very much @anoesisaudio !

I will try to use auval/auvaltool in that way! :slight_smile: