[LAD] suil error: Unable to open UI library

Cedric Roux sed at free.fr
Thu Oct 16 10:14:23 UTC 2014

On 10/15/2014 08:24 PM, Phil CM wrote:
> suil error: Unable to open UI library
> /usr/local/lib/lv2/kis.lv2/kis_gui.so
> (/usr/local/lib/lv2/kis.lv2/kis_gui.so: undefined symbol:
> _Z17instantiateSO_404PK15_LV2_DescriptordPKcPKPK12_LV2_Feature)

remove "static" for declaration of instantiateSO_404, both
in kis.h and kis.c.
static is not a type, it's a "scope" thing.
When you do:
static void function(void) {}
in a file, it basically means that this function does
not exist out of the file where you define it.
With this mechanism you can create many many "void function(void) {}"
in various source files and putting all together in a single
program will just work TM. Without "static" you would have a clash
at link time, because of more than one declaration for a symbol.
(Speaking C here, C++ might be different, I don't know.)
And yes, this is very often used.
But in your case, you must not use it.

Then, in mix.h you should add the 3 lines:
#ifdef __cplusplus
extern "C" {
near the top (let's say after all the #include lines)
and at the very end, the 3 lines:
#ifdef __cplusplus

Because kis.c is a C file and thus defines a C function.
C++ is different with functions. It will "mangle" function
names, so that "void toto(int x)" becomes "_Z4totoi" (with gcc,
might be different with various compilers; as far as I know there
is no standard for mangling names, but I might be wrong here,
c++ is not my cup of orange juice).

You run "c++filt _Z4totoi" to see the unmangled name.

Why is it needed? Because in C++ we have "signatures", not
"function names", so you may well have "void toto(int x)" and
"void toto(float x)". That can't exist in C.
And to tell the C++ compiler that the function XXX is a C function
and not a C++ you need the 'extern "C"' thing.
The #ifdef __cplusplus is there to be able to use the .h file
with both a C and a C++ compiler because 'extern "C"' is a C++
thing and a C compiler won't eat it.

Anyway, just add the six lines above.

Then, well, I tried to run with that and I still have a failure
on the symbol instantiateSO_404 (you see that this time it is
not mangled anymore).
To see something popup I had to run in the 'build' directory:
gcc -shared -pthread widget.cpp.4.o kis_gui.cpp.4.o -o 
kis.lv2/kis_gui.so -Wl,-Bdynamic -L/tmp/aa/lib -lntk -lcairo ../kis.c 
-I../../include -fPIC
(path adjustement needed if you want to reproduce)
followed by "waf install" in the upper directory.

I basically include "kis.c" in "kui_gui.so".

Then running:
jalv.gtk https://bitbucket.org/xaccrocheur/kis
sees a window popup with a menu and a slider.
I didn't test audio output. Jack is an alien beast
on my computer and today I was not into giving it
more life than a -d dummy run.

Maybe those more familiar with the lv2 bloat will be
able to help you, I can't go further than that, sorry,
my feet refuse to walk some dark territories of unnecessary


More information about the Linux-audio-dev mailing list