Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows Compilation how to ? #167

Open
rabidmachine9 opened this issue Jul 13, 2023 · 6 comments
Open

Windows Compilation how to ? #167

rabidmachine9 opened this issue Jul 13, 2023 · 6 comments

Comments

@rabidmachine9
Copy link

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
Copy link
Member

pdesaulniers commented Jul 13, 2023

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:

- name: Create Build Environment
working-directory: ${{runner.workspace}}
run: cmake -E make_directory build
- name: Configure CMake
working-directory: ${{runner.workspace}}/build
run: |
cmake "${Env:GITHUB_WORKSPACE}" -G"Visual Studio 16 2019" -A"${Env:release_arch}" -DCMAKE_BUILD_TYPE="${Env:BUILD_TYPE}" -DVCPKG_TARGET_TRIPLET="${Env:VCPKG_DEFAULT_TRIPLET}" -DCMAKE_TOOLCHAIN_FILE="${Env:VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake"
- name: Build all
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config "${Env:BUILD_TYPE}" -j 2

@rabidmachine9
Copy link
Author

rabidmachine9 commented Jul 14, 2023

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
Copy link
Member

pdesaulniers commented Jul 14, 2023

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
Copy link
Author

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
Copy link
Member

pdesaulniers commented Jul 16, 2023

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:

  • Wolf Shaper is based on DPF (DISTRHO Plugin Framework). This framework handles all the basic plugin functionality, such as audio input/output, custom UI, compiling for different plugin formats, etc. There are a few simple example plugins in the DPF repository, if you're interested. You can also find a list of plugins made with DPF here.
  • Wolf Shaper uses NanoVG for UI rendering. DPF provides a NanoVG wrapper, which is documented here. I think it is interesting to note that NanoVG is similar to the HTML Canvas API.
  • The entry point for the 'audio' part of the plugin is located in WolfShaperPlugin.cpp. The main loop is the run method.
  • The entry point for the 'UI' part is WolfShaperUI.cpp

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

  • CPU usage is quite high, especially when oversampling is enabled. This could be fixed by implementing some sort of 'cache' in the graph. I described a potential solution here: Optimize DSP #75
  • Oversampling appears to be implemented incorrectly, as seen in this issue: 2x oversampling works better than 4-16x oversampling in some circumstances #154
  • Still related to oversampling: I think the UI control isn't very intuitive. It looks like a numeric textbox, but it behaves like some kind of slider; the user needs to hold and drag the left mouse button in order to change the value. I think it could be improved.

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
Copy link
Member

pdesaulniers commented Jul 16, 2023

Another feature that would be very nice in my opinion: #47

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants