OnlineCop / kq-fork

Fork of KQ r910. Just for fun.
GNU General Public License v2.0
15 stars 9 forks source link

Runtime Error: SDL2_mixer.dll not found #153

Open TooterTutor opened 1 year ago

TooterTutor commented 1 year ago

I followed the install instructions and this is the error I get when compiling #78 and I'm getting this runtime error when trying to run it

image

z9484 commented 1 year ago

Did you follow these instructions https://github.com/OnlineCop/kq-fork/blob/road_to_1.0/INSTALL_msvc.md on the road_to_1.0 branch? I got a similar error before I installed SDL2_mixer with vcpkg

OnlineCop commented 1 year ago

Did you run this line?

$ vcpkg integrate install  # Without this step, I get "not found" errors for the SDL2, Lua, etc. packages within Visual Studio later
OnlineCop commented 1 year ago

As a follow-up, I worked with @TooterTutor a bit to see whether various vcpkg commands would let the system find SDL2_mixer.dll, but haven't come to a working solution yet. TooterTutor: If you do happen to find some steps that fix it, I'll be happy to update the INSTALL_msvc.md documentation so it would help others.

  1. In my .bashrc file, I've added the vcpkg directory to my PATH environment; that's not part of those INSTALL_msvc instructions, so that may be something to try.

  2. If I'm inside of the kq-fork directory when calling vcpkg list, I see an error:

    ~/source/repos/kq-fork$ vcpkg list
    No packages are installed. Did you mean `search`?

    However, if I'm outside of any repo, I see something different:

    ~/source/repos$ vcpkg list
    libmodplug:x64-windows                             0.8.9.0#10       The ModPlug mod file playing library.
    libpng:x64-windows                                 1.6.37#18        libpng is a library implementing an interface fo...
    lua:x64-windows                                    5.4.4#2          A powerful, fast, lightweight, embeddable script...
    sdl2-mixer:x64-windows                             2.0.4#16         Multi-channel audio mixer library for SDL.
    sdl2-mixer[libmodplug]:x64-windows                                  Support for MOD audio format.
    sdl2-mixer[nativemidi]:x64-windows                                  Support for MIDI audio format on Windows and macOS.
    sdl2:x64-windows                                   2.0.22#1         Simple DirectMedia Layer is a cross-platform dev...
    tinyxml2:x64-windows                               9.0.0#1          A simple, small, efficient, C++ XML parser
    vcpkg-cmake-config:x64-windows                     2022-02-06#1
    vcpkg-cmake:x64-windows                            2022-06-07
    zlib:x64-windows                                   1.2.12#1         A compression library

    Were you calling any of your vcpkg commands (including vcpkg integrate install within some repo? If so, does calling it somewhere else still give you that runtime error?

  3. Searching for either SDL2_mixer.dll or modplug.dll, I get these results, both under my vcpkg directory, and the kq-fork directory:

    -rwxr-xr-x 1 user 197121  74240 Sep 15 11:50 repos/vcpkg/buildtrees/sdl2-mixer/x64-windows-rel/SDL2_mixer.dll
    -rwxr-xr-x 1 user 197121 170496 Sep 15 11:50 repos/vcpkg/buildtrees/sdl2-mixer/x64-windows-dbg/SDL2_mixer.dll
    -rwxr-xr-x 1 user 197121 309760 Sep 15 11:50 repos/vcpkg/buildtrees/libmodplug/x64-windows-rel/modplug.dll
    -rwxr-xr-x 1 user 197121 671744 Sep 15 11:50 repos/vcpkg/buildtrees/libmodplug/x64-windows-dbg/modplug.dll
    
    -rwxr-xr-x 1 user 197121  74240 Jun 20 16:00 repos/vcpkg/installed/x64-windows/bin/SDL2_mixer.dll
    -rwxr-xr-x 1 user 197121 170496 Jun 20 16:00 repos/vcpkg/installed/x64-windows/debug/bin/SDL2_mixer.dll
    -rwxr-xr-x 1 user 197121 309760 Jun 20 15:57 repos/vcpkg/installed/x64-windows/bin/modplug.dll
    -rwxr-xr-x 1 user 197121 671744 Jun 20 15:57 repos/vcpkg/installed/x64-windows/debug/bin/modplug.dll
    
    -rwxr-xr-x 1 user 197121  74240 Sep 15 11:50 repos/vcpkg/packages/sdl2-mixer_x64-windows/bin/SDL2_mixer.dll
    -rwxr-xr-x 1 user 197121 170496 Sep 15 11:50 repos/vcpkg/packages/sdl2-mixer_x64-windows/debug/bin/SDL2_mixer.dll
    -rwxr-xr-x 1 user 197121 309760 Sep 15 11:50 repos/vcpkg/packages/libmodplug_x64-windows/bin/modplug.dll
    -rwxr-xr-x 1 user 197121 671744 Sep 15 11:50 repos/vcpkg/packages/libmodplug_x64-windows/debug/bin/modplug.dll
    
    -rwxr-xr-x 1 user 197121 170496 Sep 15 11:50 repos/kq-fork/out/build/x64-Debug/SDL2_mixer.dll
    -rwxr-xr-x 1 user 197121 671744 Sep 15 11:50 repos/kq-fork/out/build/x64-Debug/modplug.dll
    
    -rwxr-xr-x 1 user 197121  74240 Sep 15 11:50 repos/kq-fork/out/build/x64-Debug/vcpkg_installed/x64-windows/bin/SDL2_mixer.dll
    -rwxr-xr-x 1 user 197121 309760 Sep 15 11:50 repos/kq-fork/out/build/x64-Debug/vcpkg_installed/x64-windows/bin/modplug.dll
    -rwxr-xr-x 1 user 197121 170496 Sep 15 11:50 repos/kq-fork/out/build/x64-Debug/vcpkg_installed/x64-windows/debug/bin/SDL2_mixer.dll
    -rwxr-xr-x 1 user 197121 671744 Sep 15 11:50 repos/kq-fork/out/build/x64-Debug/vcpkg_installed/x64-windows/debug/bin/modplug.dll

    For my setup, the debug and release versions (based on the file sizes) both appear to be under my out/.../vcpkg_installed/... directories, but only the debug versions appear to be installed under out/build/x64-Debug/. Can you let us know whether any of these files are missing on your setup after you've built kq-fork.exe?

OnlineCop commented 1 year ago

I noticed that my SDL-mixer version (2.0.4) differed from the latest available via vcpkg (2.6.1) so I updated locally. When doing so, I got the same SDL2_mixer.dll not found runtime error.

Per feedback on https://github.com/libsdl-org/SDL_mixer/issues/448, I locally changed CMakeLists.txt from sdl2-mixer (lowercase and using a hyphen) to SDL2_mixer (uppercase and using underscore) and I was able to compile.

However, when running I see ERROR: Error with sound: MOD support not available and no sound is available.

See whether this at least lets you run the game; we'll figure out enabling libmodplug or something if you're able to at least get that far.

OnlineCop commented 1 year ago

The helpful people on the SDL_mixer team have suggested that we may need to manually copy one or more files over (at least for the time being; they raised a new issue which appears to be motivated by the error we've seen with vcpkg).

You should be able to find modplug.dll in one of the build/ or out/build/ subdirectories, and place it in your build directory (for Visual Studio, I believe the default would be out/build/x64-Debug/, which is where kq-fork.exe resides).

Once I had that DLL in the same directory as the executable, SDL_mixer was able to play MOD files for me.