Cross compile DPF for Windows

Programming applications for making music on Linux.

Moderators: MattKingUSA, khz

Post Reply
User avatar
Michael Willis
Established Member
Posts: 1450
Joined: Mon Oct 03, 2016 3:27 pm
Location: Rocky Mountains, North America
Has thanked: 68 times
Been thanked: 162 times
Contact:

Cross compile DPF for Windows

Post by Michael Willis »

Hey FalkTX (or anybody else), can I cross compile a DPF project to make a Windows VST from Linux? After a cursory investigation I learned that mingw can be used to compile Windows binaries, so I installed it and trying running

Code: Select all

make WIN32=true
on my project, but the build promptly failed with this cryptic message:

Code: Select all

/usr/bin/ld: /tmp/ccknSAGM.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/tmp/ccknSAGM.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
../Makefile.mk:135: recipe for target '../../bin/DragonflyReverb.lv2/DragonflyReverb_dsp.dll' failed
I was thinking about hacking around with the Makefiles to introduce the -fPIC parameter, but then decided I should probably ask after your last commentary about my hacks on the Makefiles :oops:
User avatar
lucianodato
Established Member
Posts: 156
Joined: Sat May 15, 2010 9:00 pm
Has thanked: 3 times
Been thanked: 16 times

Re: Cross compile DPF for Windows

Post by lucianodato »

Damien from zamaudio did something like that using travisci look at his repo.
Arguy (IRC)
User avatar
Michael Willis
Established Member
Posts: 1450
Joined: Mon Oct 03, 2016 3:27 pm
Location: Rocky Mountains, North America
Has thanked: 68 times
Been thanked: 162 times
Contact:

Re: Cross compile DPF for Windows

Post by Michael Willis »

lucianodato wrote:Damien from zamaudio did something like that using travisci look at his repo.
Oh nice, this is looking promising: Cross compiling: Add build scripts for OSX/WIN/GNU using docker
falkTX wrote:I bet you do not have the needed mingw setup on the environment, because -fPIC is not needed for windows builds.
Thanks, all I tried was installing the debian package mingw-w64 and running the make. I'll learn a bit more about mingw and get wine set up, then try again.
User avatar
Michael Willis
Established Member
Posts: 1450
Joined: Mon Oct 03, 2016 3:27 pm
Location: Rocky Mountains, North America
Has thanked: 68 times
Been thanked: 162 times
Contact:

Re: Cross compile DPF for Windows

Post by Michael Willis »

falkTX wrote:... mingw ... wine ...
Ok, I got a little bit further. I found that I can run the following command and it uses the mingw compiler instead of gcc/g++:

Code: Select all

make WIN32=true CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++
It looks like it compiles all of my source files, but then when it gets to the linking phase it doesn't know how to find fftw3:

Code: Select all

/usr/bin/x86_64-w64-mingw32-ld: cannot find -lfftw3f
collect2: error: ld returned 1 exit status
../Makefile.mk:135: recipe for target '../../bin/DragonflyReverb.lv2/DragonflyReverb_dsp.dll' failed
This is understandable, but I don't know where to put the fftw3 library. Ideally I want to statically link fftw3, but it's not clear to me how to properly set up my Makefiles to do so.

Furthermore, just to see if I could get *any* DPF project to cross compile, I tried building the Distrho Mverb project, and it gave me this when it tried to create the lv2:

Code: Select all

err:module:import_dll Library libgcc_s_seh-1.dll (which is needed by L"Z:\\home\\michael\\workspace\\MVerb\\bin\\MVerb.lv2\\MVerb_dsp.dll") not found
err:module:import_dll Library libstdc++-6.dll (which is needed by L"Z:\\home\\michael\\workspace\\MVerb\\bin\\MVerb.lv2\\MVerb_dsp.dll") not found
Failed to open plugin DLL
Makefile:26: recipe for target 'gen' failed
It does look like it built the Windows VST for that project, but I'm not sure if the VST has any dependencies dynamically linked.
User avatar
Michael Willis
Established Member
Posts: 1450
Joined: Mon Oct 03, 2016 3:27 pm
Location: Rocky Mountains, North America
Has thanked: 68 times
Been thanked: 162 times
Contact:

Re: Cross compile DPF for Windows

Post by Michael Willis »

falkTX wrote:Ok, so..
Thanks falkTX. I got the make command to succeed, and a dll file showed up in the bin dir. One windows user tested it and told me this:
Samulis wrote:I tried it in Reaper and Finale, but it wouldn't even get recognized by the plugin scanners. I don't know if there's a log somewhere for those, but no errors came up.
I'm not really sure what to do from here. For what it's worth, here's the file: https://github.com/michaelwillis/dragon ... v0.9.0.zip
User avatar
Michael Willis
Established Member
Posts: 1450
Joined: Mon Oct 03, 2016 3:27 pm
Location: Rocky Mountains, North America
Has thanked: 68 times
Been thanked: 162 times
Contact:

Re: Cross compile DPF for Windows

Post by Michael Willis »

falkTX wrote:When loaded into carla
Oh right, I didn't even think of using the Carla bridge to test it! I thought I just had to blindly send the dll to somebody with windows.
falkTX wrote:Careful if you use the fftw planner, needs some tricks to make sure concurrent use does not crash.
I changed my spectrogram implementation such that it doesn't use a separate thread to render (per the suggestion of the ardour devs). Now It renders in chunks during the uiIdle event.
Post Reply