COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 01-14-2018, 11:03 AM   #1
Veto
Human being with feelings
 
Join Date: Aug 2010
Posts: 799
Default SWELL sample project for Linux

Hi everybody,

For learning purposes I'd like to port the SWELL sample project to Linux.

This is what I did so far:
  1. Based on the Makefiles for the Linux Swell port for Reaper and the SWS extension (which uses Reapers Swell API, i.e SWELL_PROVIDED_BY_APP is set) I created this Makefile ***.
  2. In app_main.cpp *** I commented some lines regarding modifications to the menu (because SWELL_app_stocksysmenu threw an error and the goal is to just get a simple window going anyways)
  3. In main_dialog.cpp *** I commented SWELL_PostQuitMessage(hwndDlg) because it seems not to be implemented yet for Linux.

Unfortunately I get this linker error: "/usr/bin/ld: swell-generic-gdk.o: undefined reference to symbol 'XFree'".
Did I miss any compiler/linker options? Log output is pretty much the same as with Reapers Swell (apart from that it is of course not a shared library).
This is my full log:
https://pastebin.com/S6z8GqrF

Notes:
- I'm aware that I probably included way too many objects and compiler/linker options as needed in the Makefile for this simple project but to rule out errors I wanted it to be as similar to the Reaper Swell makefile as possible.
- In the makefile I set SWELL_TARGET_GDK_NO_CURSOR_HACK ***. If I don't do that I get the linker error "/usr/bin/ld: swell-generic-gdk.o: undefined reference to symbol 'XIDefineCursor'". Also it seems that it is set with Reapers Swell too (I can't find where though).


***
EDIT: updated project here:
https://github.com/veto-gh/WDL/tree/...sample_project

Last edited by Veto; 01-30-2018 at 12:55 PM.
Veto is offline   Reply With Quote
Old 01-14-2018, 11:19 AM   #2
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 1,712
Default

XFree is exported by libX11.so and XIDefineCursor by libXi.so. Add -lX11 -lXi to the linker flags or link against libSwell.so instead of embedding it in the application.
cfillion is online now   Reply With Quote
Old 01-14-2018, 11:41 AM   #3
Veto
Human being with feelings
 
Join Date: Aug 2010
Posts: 799
Default

Thanks again cfillion. I think that did the trick, though it's now complaining about an "undefined reference to `main'" which makes sense since I only have SWELLAppMain. Need to find out how to fix this next.

Quote:
Originally Posted by cfillion View Post
link against libSwell.so instead of embedding it in the application.
My goal is to do a self-contained example app.

Just out of interest do you have any clue why "-lX11 -lXi" is not needed for Swell with Reaper (unless PRELOAD_GDK is set)? Maybe because it's shared?

Last edited by Veto; 01-14-2018 at 11:55 AM.
Veto is offline   Reply With Quote
Old 01-14-2018, 11:56 AM   #4
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 1,712
Default

Quote:
Originally Posted by Veto View Post
Just out of interest do you have any clue why "-lX11 -lXi" is not needed for Swell with Reaper (unless PRELOAD_GDK is set)? Maybe because it's shared?
Undefined symbols are ignored when building a shared library. GDK is linked against X11 and Xi so the symbols are found at runtime.

Last edited by cfillion; 01-14-2018 at 12:04 PM.
cfillion is online now   Reply With Quote
Old 01-14-2018, 12:03 PM   #5
Veto
Human being with feelings
 
Join Date: Aug 2010
Posts: 799
Default

Thank you, thats a great explanation.
Veto is offline   Reply With Quote
Old 01-14-2018, 03:31 PM   #6
Veto
Human being with feelings
 
Join Date: Aug 2010
Posts: 799
Default

EDIT: Ok, roughly got something running in main (window+menu showing up,message loop running).

Last edited by Veto; 01-17-2018 at 10:21 PM.
Veto is offline   Reply With Quote
Old 01-17-2018, 10:36 PM   #7
Veto
Human being with feelings
 
Join Date: Aug 2010
Posts: 799
Default

What is the correct way to end the main loop on window/dialog destroy?
If I do
PHP Code:
HWND hwnd CreateDialog(g_hInst,MAKEINTRESOURCE(IDD_DIALOG1),NULL,MainDlgProc);

while (!
hwnd->m_hashaddestroy) {
    
SWELL_RunMessageLoop();
    
Sleep(10);
  } 
I get "invalid use of incomplete type ‘struct HWND__’" on line 3.

I can resolve it by including swell-internal.h but I don't think this is encouraged?

I think the problem is that HWND (typedef'ed HWND__) is forward declared in swell-types.h (included in swell.h, which I include) while it is defined in swell-internal.h (which isn't included in swell.h).
Am I doing things fundamentally wrong?

This is the line: https://github.com/veto-gh/wdl_v/blo..._main.cpp#L196

Last edited by Veto; 01-18-2018 at 09:20 AM.
Veto is offline   Reply With Quote
Old 01-30-2018, 11:35 AM   #8
olilarkin
Human being with feelings
 
olilarkin's Avatar
 
Join Date: Apr 2009
Location: Huddersfield, UK
Posts: 1,066
Default

hey, any chance you can put your swell sample project makefile back online?
__________________
VirtualCZ | pMix | Endless Series | WDL-OL | Linkedin | Facebook
Available for Audio Dev tuition via Skype (IPlug/JUCE/C++)
olilarkin is offline   Reply With Quote
Old 01-30-2018, 12:26 PM   #9
Veto
Human being with feelings
 
Join Date: Aug 2010
Posts: 799
Default

Sure Oli (sry it got lost on switching my WDL clone to a fork)
Makefile:
https://github.com/veto-gh/WDL/blob/...oject/Makefile
Project:
https://github.com/veto-gh/WDL/tree/...sample_project

If you want to look at the source though, I'm not very convinced that I'm doing things right (not sure if the loop around SWELL_RunMessageLoop() makes sense). But it seems to work so..


You need php installed (for the resource files) and uses Gdk 2 by default. Just change the 2 lines with "gdk-2.0" to "gdk-3.0" if you want to use Gdk 3 instead.

Last edited by Veto; 01-30-2018 at 01:02 PM.
Veto is offline   Reply With Quote
Old 01-30-2018, 12:59 PM   #10
olilarkin
Human being with feelings
 
olilarkin's Avatar
 
Join Date: Apr 2009
Location: Huddersfield, UK
Posts: 1,066
Default

great thanks it works.
__________________
VirtualCZ | pMix | Endless Series | WDL-OL | Linkedin | Facebook
Available for Audio Dev tuition via Skype (IPlug/JUCE/C++)
olilarkin is offline   Reply With Quote
Old 02-17-2018, 06:53 AM   #11
olilarkin
Human being with feelings
 
olilarkin's Avatar
 
Join Date: Apr 2009
Location: Huddersfield, UK
Posts: 1,066
Default

I'm looking for a volunteer to help get IPlug/IGraphics (iplugquake) working nicely on Linux.

here is a good start:

https://github.com/olilarkin/wdl-ol/.../IGraphicsTest

if anyone who might like to help :-) I've got lots of other things to look at so will put linux to oneside

join us on slack!
__________________
VirtualCZ | pMix | Endless Series | WDL-OL | Linkedin | Facebook
Available for Audio Dev tuition via Skype (IPlug/JUCE/C++)
olilarkin is offline   Reply With Quote
Old 02-18-2018, 06:36 PM   #12
Veto
Human being with feelings
 
Join Date: Aug 2010
Posts: 799
Default

Unfortunately I never played with IPlug and I have no access to Win/OSX to try out (support for linux would be so amazing) so I'm probably the wrong guy to set up an example project. Still I dare to ask, what needs to be done?

(I did notice to build it, I needed to add "CFLAGS += -std=c++11" to the makefile and rename the "FPS" macro, probably shadowing a function with the same name?)
Veto is offline   Reply With Quote
Old Yesterday, 04:34 PM   #13
olilarkin
Human being with feelings
 
olilarkin's Avatar
 
Join Date: Apr 2009
Location: Huddersfield, UK
Posts: 1,066
Default

thanks, modified the makefile and src. Lv2 etc support on linux would be great, but very far down the list for me. I just want to run standalone synths on a rpi :-)
__________________
VirtualCZ | pMix | Endless Series | WDL-OL | Linkedin | Facebook
Available for Audio Dev tuition via Skype (IPlug/JUCE/C++)
olilarkin is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 08:18 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.