Supercollider: Supernova attempts to load non-plugin files

Created on 19 Jan 2018  路  3Comments  路  Source: supercollider/supercollider

First off - thank you thank you THANK YOU @florian-grond and @brianlheim for https://github.com/supercollider/supercollider/pull/3433! I was so looking forward to this!

Took if for a spin and it works, however...
Looks like now supernova tries to also load some non-plugin files, and when it fails, it does not boot. These files need to be removed from Extensions in order to boot.

One example is the ladspalist file from SC3Plugins/LadspaUGen/. The booting process is reported as follows:

Server.supernova;
s.boot;

Supernova booting
Available Audio Devices:
0: Built-in Microphone (2 inputs, 0 outputs)
1: Built-in Output (0 inputs, 2 outputs)

ERROR: API version not found: /Users/somePath/Extensions/SC3plugins/LadspaUGen/ladspalist
This file may not be a SuperCollider plugin.

RESULT = 0

(the server quits)

This also happened for a random .bin file I had linked to Extensions as a leftover from compiling some other plugin. I got a similar message:

ERROR: API version not found: /Users/somePath/Extensions/someOtherPath/CMakeDetermineCompilerABI_C.bin
This file may not be a SuperCollider plugin.

RESULT = 0

To clarify, these files don't bother scsynth, which boots fine with them living inside the Extensions folder.

I'm on the latest 3.9 branch (https://github.com/supercollider/supercollider/commit/abe5a2dfa5e84e14b9f56ec77f869f9301259e07) on macOS 10.12.6. SC3Plugins were built against the updated SC source.

bug supernova fix proposed

Most helpful comment

Thanks for the report @dyfer! Supernova's loading routine blindly tries to open any file in its path as a dynamic lib. Some of these objects are being loaded as dynamic libraries but then failing further checks since they don't have the symbol Supernova wants.

A very bad (non-portable, "magic strings") but functional solution for this problem on macOS would be:

diff --git a/server/supernova/sc/sc_ugen_factory.cpp b/server/supernova/sc/sc_ugen_factory.cpp
index eb9d340de..d15f2923c 100644
--- a/server/supernova/sc/sc_ugen_factory.cpp
+++ b/server/supernova/sc/sc_ugen_factory.cpp
@@ -230,7 +230,7 @@ void sc_ugen_factory::load_plugin_folder (boost::filesystem::path const & path)
         return;

     for (directory_iterator it(path); it != end; ++it) {
-        if (is_regular_file(it->status()))
+        if (is_regular_file(it->status()) && it->path().extension() == "scx")
             load_plugin(it->path());
         if (is_directory(it->status()))
             load_plugin_folder(it->path());

But, a better solution shouldn't be too hard. I'm kind of glad the bug is in this particular section actually, because it can be cleanly refactored to eliminate the win/posix code duplication.

All 3 comments

Thanks for the report @dyfer! Supernova's loading routine blindly tries to open any file in its path as a dynamic lib. Some of these objects are being loaded as dynamic libraries but then failing further checks since they don't have the symbol Supernova wants.

A very bad (non-portable, "magic strings") but functional solution for this problem on macOS would be:

diff --git a/server/supernova/sc/sc_ugen_factory.cpp b/server/supernova/sc/sc_ugen_factory.cpp
index eb9d340de..d15f2923c 100644
--- a/server/supernova/sc/sc_ugen_factory.cpp
+++ b/server/supernova/sc/sc_ugen_factory.cpp
@@ -230,7 +230,7 @@ void sc_ugen_factory::load_plugin_folder (boost::filesystem::path const & path)
         return;

     for (directory_iterator it(path); it != end; ++it) {
-        if (is_regular_file(it->status()))
+        if (is_regular_file(it->status()) && it->path().extension() == "scx")
             load_plugin(it->path());
         if (is_directory(it->status()))
             load_plugin_folder(it->path());

But, a better solution shouldn't be too hard. I'm kind of glad the bug is in this particular section actually, because it can be cleanly refactored to eliminate the win/posix code duplication.

Instead define SC_PLUGIN_EXT in cmake as scsynth and then

if (is_regular_file(it->status()) && it->path().extension() == SC_PLUGIN_EXT )

fixed in #3815. supernova plugin loading is now identical to scsynth.

Was this page helpful?
0 / 5 - 0 ratings