pantherb / setBfree

DSP tonewheel organ
http://setbfree.org
GNU General Public License v2.0
194 stars 35 forks source link

Whirl GUI on Linux with Ardour & cross compiling issue #64

Closed GeorgeNs closed 5 years ago

GeorgeNs commented 5 years ago

Thanks for all this amazing stuff.

1.I have tried to compile the setBfree and i could use it with success on linux as standalone and plugin too. However, trying to compile and use individual parts of this project,such as whirl,I could still use the plugin but the GUI .so file it seems doesn't work,thus i can only open the gui provided by ardour. I didn't get any errors during building time, is this normal or i miss something?The whirl standalone works without issues.

2.Also i tried to cross compile it for windows but compilation stuck on gobject_init_ctor() constructor issue that says it is not declared in this scope...glib and necessary libraries are installed. Is there any workaround or is the cross compiling kind impossible?

Cheers

x42 commented 5 years ago

re (1) the only custom GUIs are for setBfree and the extended Leslie. try make SUBDIRS="b_synth ui src"

re (2) https://x42-plugins.com/x42/setBfree are cross-compiled. glib for windows does not support default linking by default. On Unices it uses __attribute__((constructor)); while for mingw/windows there are only calls to DllMain. When statically linking glib is no longer a .dll so DLLMain isn't called, and static initialization needs to be explicit. Also when compiling glib with mingw (instead of MSVC), symbols are exported globally. That needs to be overridden, search for _GLIB_EXTERN in the glib configure file, remove __declspec(dllexport) and undefine DLL_EXPORT there, also compile glib with -fvisibility=hidden and apply:

--- a/glib/gwin32.h
+++ b/glib/gwin32.h
@@ -111,6 +111,13 @@
 #define G_WIN32_IS_NT_BASED() TRUE
 #define G_WIN32_HAVE_WIDECHAR_API() TRUE

+/* explicit static initialization */
+GLIB_AVAILABLE_IN_ALL
+void glib_init_static(void);
+
+GLIB_AVAILABLE_IN_ALL
+void glib_cleanup_static(void);
+
 G_END_DECLS

 #endif  /* G_PLATFORM_WIN32 */
--- a/glib/glib-init.c
+++ b/glib/glib-init.c
@@ -273,6 +273,16 @@
   return TRUE;
 }

+void
+glib_init_static(void) {
+ DllMain(NULL, DLL_PROCESS_ATTACH, 0);
+}
+
+void
+glib_cleanup_static(void) {                                                                                                                                                                   
+ DllMain(NULL, DLL_PROCESS_DETACH, 0);
+}
+
 #elif defined (G_HAS_CONSTRUCTORS)

 #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
GeorgeNs commented 5 years ago

1.Thank you,now individual parts can be compiled and open their gui in ardour too

2.I will try this one day,currently i have the mxe environment with the shared mingw32 version(x86_64) and it has its packages ready,so i need to change many things there,remove and recompile. Probably I will need the static version(?) also i will need to use the pthreadsGC2 library for the attach/detach_np to work.

But as i can see there are some plugins with license although they are open source! Maybe not so good to compile them now.definitely i will support this once i have the possibility. Thnx

x42 commented 5 years ago

You can remove the -DRTK_STATIC_INIT define in b_whirl/Makefile for a local build, however plugins must be self-contained, so dynamically linking is not really an option.

GeorgeNs commented 5 years ago

Yes i need a new setup, anyway on linux works well and that's great Thanks a lot