How to setup scsynth debugging?

I currently try to learn some C++ and for this I want to take a look at scsynth and try out some things.
As IDE I want to use vscode for now and I managed that I can build and inspect everything by creating a .vscode/settings.json file with content

    "cmake.configureArgs": [
        "-DCMAKE_PREFIX_PATH=`brew --prefix qt5`"
    "cmake.debugConfig": {
        "args": [
            "-u", "57110", 

The debugConfig is hardcoded for scsynth right now but it allows me to spawn a scsynth where I can attach a debugger. Maybe I’ll write a wiki article on a multi-plattform setup w/ vscode.

After starting scsynth in the debug environment of vscode I try to connect to the server with my normal IDE by using

t = Server.remote(\remote, NetAddr("", 57110));

with output

remote : setting clientID to 0.
-> remote
Requested notification messages from server 'remote'
remote: server process has maxLogins 64 - adjusting my options accordingly.
remote: keeping clientID (0) as confirmed by server process.

followed by

SynthDef(\foo, {|out|,*0.2)}).send(t)
a = Synth(\foo)

which results in no sound

The output on my scsynth is

@"SC_AudioDriver: sample rate = 48000.000000, driver's block size = 512\r\n"
@"PublishPortToRendezvous 0 5855\r\n"
@"SuperCollider 3 server ready (debug build).\r\n"
@"exception in GraphDef_Recv: UGen 'Control' not installed.\r\n"
@"exception in GraphDef_Recv: UGen 'TrigControl' not installed.\r\n"
@"exception in GraphDef_Recv: UGen 'Control' not installed.\r\n"
@"exception in GraphDef_Recv: UGen 'TrigControl' not installed.\r\n"
@"exception in GraphDef_Recv: UGen 'Control' not installed.\r\n"
@"FAILURE IN SERVER /g_new negative node IDs are reserved\r\n"
@"exception in GraphDef_Recv: UGen 'Control' not installed.\r\n"
@"*** ERROR: SynthDef foo not found\r\n"
@"FAILURE IN SERVER /s_new SynthDef not found\r\n"

So somehow the SynthDef foo did not get added to server. And it seems strange to me that all those things like Control are “not installed”?

I also tried calling t.boot as

You cannot boot a server app on a remote machine, but you can initialize the allocators by calling this message.

from Server | SuperCollider 3.12.2 Help - whatever this means? But with no succes.

So the question is how do I connect to a server which is not managed by sclang? Also adding the -I and -O flags to scsynth did not change the behavior.

It’s much easier and more reliable to get vscode / lldb to attach to a running scsynth process than it is to get sclang to attach to a remotely running scsynth. I use this:

{         // .vscode/launch.json 
    "configurations": [

            "type": "lldb",
            "request": "attach",
            "name": "Attach",
            "program": "${workspaceFolder}/build-Debug/Install/SuperCollider/",
            "waitFor": true

You’ll have to adjust the path to reflect the structure of your build folder and which executable you want to debug (this is for sclang, but you can make another entry for scsynth as well). IIRC the waitFor parameter doesn’t work right, making it hard to catch bugs that occur AS the server is booting, but otherwise I find this works well.

1 Like

Thanks for the hint, works with sclang and scsynth as well.