wolf-plugins / wolf-shaper

Waveshaper plugin with a spline-based graph editor (LV2, VST, and CLAP)
https://wolf-plugins.github.io/wolf-shaper/
GNU General Public License v3.0
219 stars 20 forks source link

Windows Compilation how to ? #167

Open rabidmachine9 opened 1 year ago

rabidmachine9 commented 1 year ago

I have installed gcc, make and cmake via scoop package manager but when I am running make I get the following output

process_begin: CreateProcess(NULL, cc -dumpmachine, ...) failed.
dpf/Makefile.base.mk:61: pipe: Bad file descriptor
C:/Users/kpatch/scoop/apps/make/current/bin/make.exe -C dpf/dgl opengl
make[1]: Entering directory 'C:/Users/kpatch/src/wolf-shaper/dpf/dgl'
process_begin: CreateProcess(NULL, cc -dumpmachine, ...) failed.
../Makefile.base.mk:61: pipe: Bad file descriptor
make (e=2): The system cannot find the file specified.
make[1]: [Makefile:187: ../build/dgl/Application.cpp.o] Error 2 (ignored)
Compiling src/Application.cpp
In file included from src/../Application.hpp:20,
                 from src/ApplicationPrivateData.hpp:20,
                 from src/Application.cpp:17:
src/../Base.hpp:31:27: fatal error: error writing to -: Invalid argument
   31 | #define END_NAMESPACE_DGL }
      |                           ^
src/Application.cpp:112:1: note: in expansion of macro 'END_NAMESPACE_DGL'
  112 | END_NAMESPACE_DGL
      | ^~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:18: libs] Error 2

Any ideas on how I could do that ? Thanks in advance

pdesaulniers commented 1 year ago

Hello,

I haven't tried to compile the program on an actual Windows machine myself, so it's a bit difficult for me to troubleshoot this. Also, I am not familiar with 'scoop'. I know that MSYS2 used to work pretty well for building Unix-y programs on Windows, but I haven't personally tested it with Wolf Shaper.

Right now, to build the official Windows binaries, I use MinGW on a Linux Machine.

Based on the output that you sent, it seems like the shell commands in the Makefile are not behaving correctly. Perhaps the Makefile is using Windows CMD instead of a Unix shell?

Also, instead of building Wolf Shaper with the GNU Makefile, have you tried using CMake? At least, I know it is possible to compile Wolf Shaper with Visual Studio 2019 (MSVC) and CMake. If you need an example, I have configured a workflow which builds the plugin with Visual Studio and CMake at every commit: https://github.com/wolf-plugins/wolf-shaper/blob/15879056a2a15484760efc94c96e9e533c9b5398/.github/workflows/msvc.yml#L30-L39

rabidmachine9 commented 1 year ago

Scoop is a package manager that allows you to install several mostly open source packages in a windows system. And yes I tried building in PowerShell not in a Unix shell I will try building with MSYS2 first and move on to the other suggestions. Sorry for my ignorance but how am I supposed to build is running 'make' just enough in order to try and build with a makefile or maybe I need to add some other options? Also how would I choose to build with CMake over make. Thanks for your answer :)

pdesaulniers commented 1 year ago

how am I supposed to build is running 'make' just enough in order to try and build with a makefile or maybe I need to add some other options?

Yes, running make should be enough, assuming the necessary dependencies are installed. On Windows, I think you only need a C++ compiler.

Also how would I choose to build with CMake over make.

Generally, the steps are similar for most CMake-based projects. Here is one way to do it (these commands should be executed at the root of the wolf-shaper repository):

cmake -S . -B build -G "Unix Makefiles"
cmake --build build

The first command tells CMake to create its build files into a directory called build. It also tells CMake that the build files should be in "Unix Makefiles" format. If you leave out the -G "Unix Makefiles" argument, it should pick a reasonable default for your current platform.

The second command tells CMake to execute the build files that it created in the first step.

I will try building with MSYS2 first and move on to the other suggestions.

Do you plan on modifying and/or reusing Wolf Shaper's source code? If so, I think I would recommend using an IDE such as Visual Studio Community instead. Visual Studio has built-in support for CMake, and I assume it can provide a nice development experience overall (auto-completion, code analysis, debugger, etc).

If you need more help with this, I can probably setup a Windows machine and write some sort of guide on how to build Wolf Shaper on Windows. At least, I think you're one of the first to try it, so I don't have any clear instructions at the present time :)

rabidmachine9 commented 1 year ago

Turns out it is pretty simple if you know your way around a few things.

First I tried compiling with MSYS2 but it turned out to be a little more complicated than I expected. So I just tried your cmake commands and that was it.

So in my experience all you have to do is install 3 packages with your preferred package manager (in my case scoop): scoop install make gcc cmake

and then run your cmake commands

cmake -S . -B build -G "Unix Makefiles"
cmake --build build

and that's it, you don't really anything else I managed to build and run the standalone .exe and load the .vst3 in Ableton Live

In my opinion adding some guidelines for Windows (or cmake?) compilation in the readme file would be a very good start.

For now I think will stick using VSCodium which seem to have all the necessary extensions for C and C++ programming since VisualStudio has given me headaches in the past.

As for your question, I would like to contribute some code eventually but since I haven't really 'dug' into the code yet I don't really know how close am I to that. If you could provide some guidance with that it would be great, maybe some issues I could look into? or some important files or readings ?

Anyway thanks for all the help and guidance :)

pdesaulniers commented 1 year ago

I managed to build and run the standalone .exe and load the .vst3 in Ableton Live

Awesome!

In my opinion adding some guidelines for Windows (or cmake?) compilation in the readme file would be a very good start.

Yes, I agree :)

If you could provide some guidance with that it would be great, maybe some issues I could look into? or some important files or readings ?

Here is a bit of information that might be useful:

Right now, here are some of the issues that annoy me the most about the plugin:

These are the first issues that come to my mind. Of course, if you have some ideas for interesting features, feel free to suggest them :)

pdesaulniers commented 1 year ago

Another feature that would be very nice in my opinion: https://github.com/wolf-plugins/wolf-shaper/issues/47

This feature would tackle a lot of existing issues at once, and it wouldn't involve complicated DSP :)