soloud
soloud copied to clipboard
MinGW64 Builds - Windows detection for DLL loading functions in backend/soloud_*_dll.c is incorrect
Expected behavior:
Windows should be detected correctly so that it doesn't try to #include <dlfcn.h> and the rest of linuxy stuff
Actual behavior:
Since MinGW doesn't #define _MSC_VER it defaults to linuxy build.
Steps to reproduce the problem:
- build openal/sdl2/portaudio
- install openal/sdl2/portaudio headers/dlls globally (C:/msys/mingw64/x86_64-w64-mingw32)
- edit genie.lua to point backends to correct include/lib locations
- edit soloud_devel.bat
genie --soloud-devel --cc=gcc --platform=x64 gmake - execute soloud_devel.bat
- cd gmake
- make -j24
C:\code\soloud\build\gmake>mingw32-make.exe -j24
"==== Building SoloudDemoCommon (debug) ===="
"==== Building SoloudStatic (debug) ===="
"==== Building codegen (debug) ===="
"==== Building lutgen (debug) ===="
"==== Building resamplerlab (debug) ===="
soloud_openal_dll.c
soloud_portaudio_dll.c
soloud_sdl2_dll.c
soloud_fftfilter.cpp
soloud_flangerfilter.cpp
soloud_freeverbfilter.cpp
soloud_lofifilter.cpp
soloud_robotizefilter.cpp
soloud_waveshaperfilter.cpp
../../src/backend/portaudio/soloud_portaudio_dll.c:72:10: fatal error: dlfcn.h: No such file or directory
72 | #include <dlfcn.h> // dll functions
| ^~~~~~~~~
compilation terminated.
mingw32-make[1]: *** [SoloudStatic.make:656: debug/Debug/SoloudStatic/src/backend/portaudio/soloud_portaudio_dll.o] Error 1
mingw32-make[1]: *** Waiting for unfinished jobs....
../../src/backend/openal/soloud_openal_dll.c:117:10: fatal error: dlfcn.h: No such file or directory
117 | #include <dlfcn.h> // dll functions
| ^~~~~~~~~
compilation terminated.
mingw32-make[1]: *** [SoloudStatic.make:648: debug/Debug/SoloudStatic/src/backend/openal/soloud_openal_dll.o] Error 1
../../src/backend/sdl/soloud_sdl2_dll.c:66:10: fatal error: dlfcn.h: No such file
or directory
66 | #include <dlfcn.h> // dll functions
| ^~~~~~~~~
compilation terminated.
mingw32-make[1]: *** [SoloudStatic.make:672: debug/Debug/SoloudStatic/src/backend/sdl/soloud_sdl2_dll.o] Error 1
mingw32-make: *** [Makefile:37: SoloudStatic] Error 2
SoLoud version, operating system, backend used, any other potentially useful information:
openal sdl2 portaudio possibly more non-windows only backends
Suggested Fix
- #if defined(_MSC_VER)
+ #if defined(_MSC_VER) || defined(_WIN32)
In each of the related files
Please note using __GNUC__ is not a valid solution because dlopen is native to linux.
Also, I am just now realizing but the issue is much larger than the scope of these files. See, I was installing globally because of the use of #include <name.h> but _MSC_VER never pops so everything builds linuxy, which is mostly always fine because MinGW64 is supposed to be at least significantly resilient to compiling linuxy code. It goes without saying but there is no local installs of sources in Linux hardly ever, its always global.
soloud_demo_framework.cpp
#if defined(_MSC_VER)
#include "SDL.h"
#include <windows.h>
#include "GL/glew.h"
#else
#ifdef __EMSCRIPTEN__
#include "emscripten.h"
#include <SDL2/SDL.h>
#include <GLES2/gl2.h>
#else
#include <SDL2/SDL.h>
#include "GL/glew.h"
#include <GL/gl.h>
#endif
#endif
Take this for an example of the situation. If one is to use genie, its down right stupid to use globally installed headers because the paths are already specified.