Build SDL3.DLL from Linux

I downloaded the sources of SDL3 and compiled and installed it with cmake under Linux.
It works wonderfully.

Now to the question, can I build an SDL3.DLL for Windows from Linux using the sources?

You can use the MinGW w64 toolkit for cross-compilation. You will also need MinGW w64 CMake to configure SDL3 for building.

So it seems there is no direct way with any parameters in “cmake” or “make” ?

Or can you at least download the SDL3.DLL somewhere reputable, e.g. at

There I only find version 2.30.1

What do you mean by “direct way”? You need a cross-compiler to compile a binary for a different target, that’s the “direct way”.

SDL3 has no release yet, but you can download a build from CI:

This is how I set up cmake for cross compiling, paths may be different on your system:

cmake -S ~/path_to_SDL_root_dir/ -B . -DCMAKE_CXX_COMPILER="/usr/bin/x86_64-w64-mingw32-g++" -DCMAKE_C_COMPILER="/usr/bin/x86_64-w64-mingw32-gcc" -DCMAKE_RC_COMPILER="/usr/bin/x86_64-w64-mingw32-windres" -DCMAKE_FIND_ROOT_PATH="/usr/x86_64-w64-mingw32" -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE="BOTH" -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY="ONLY" -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM="BOTH" -DCMAKE_SYSTEM_NAME="Windows" --install-prefix ~/SDL_install_path/

Thanks, that’s exactly what I was looking for.

I just saw that there is a 3.1 version of SDL at Assert on github. And you can also get the finished DLLs there.
What I noticed is that the SDL3.DLL there only has 1.9MB. And the one I built myself has 11.8MB!
What is the reason for this?

Is there also a command with which you can build a DLL that works for win32 and 64?

What I noticed is that the SDL3.DLL there only has 1.9MB. And the one I built myself has 11.8MB!
What is the reason for this?

Nobody has an idea?

@es5804
This is how I set up cmake for cross compiling, paths may be different on your system:
cmake -S ~/path_to_SDL_root_dir/ -B . -DCMAKE_CXX_COMPILER="/usr/bin/x86_64-w64-mingw32-g++" -DCMAKE_C_COMPILER="/usr/bin/x86_64-w64-mingw32-gcc" -DCMAKE_RC_COMPILER="/usr/bin/x86_64-w64-mingw32-windres" -DCMAKE_FIND_ROOT_PATH="/usr/x86_64-w64-mingw32" -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE="BOTH" -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY="ONLY" -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM="BOTH" -DCMAKE_SYSTEM_NAME="Windows" --install-prefix ~/SDL_install_path/

I also wanted to try this for the latest libSDL3 image. But unfortunately this is acknowledged with the following error

$ cmake -S ../SDL_image/ -B . -DCMAKE_CXX_COMPILER="/usr/bin/x86_64-w64-mingw32-g++" -DCMAKE_C_COMPILER="/usr/bin/x86_64-w64-mingw32-gcc" -DCMAKE_RC_COMPILER="/usr/bin/x86_64-w64-mingw32-windres" -DCMAKE_FIND_ROOT_PATH="/usr/x86_64-w64-mingw32" -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE="BOTH" -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY="ONLY" -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM="BOTH" -DCMAKE_SYSTEM_NAME="Windows"
-- The C compiler identification is GNU 10.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring SDL3_image 3.0.0
-- Performing Test CHECK_CPU_ARCHITECTURE_X64
-- Performing Test CHECK_CPU_ARCHITECTURE_X64 - Success
-- Performing Test LINKER_SUPPORTS_VERSION_SCRIPT
-- Performing Test LINKER_SUPPORTS_VERSION_SCRIPT - Success
-- Performing Test HAVE_WL_NO_UNDEFINED
-- Performing Test HAVE_WL_NO_UNDEFINED - Success
-- libavif-1.0 or compatible not found
-- libavif NOT found
-- Could NOT find TIFF (missing: TIFF_LIBRARY TIFF_INCLUDE_DIR) 
-- libtiff NOT found
-- Could NOT find webp (missing: webp_LIBRARY webp_INCLUDE_PATH webpdemux_LIBRARY webpdemux_INCLUDE_PATH) 
-- libwebp NOT found
-- Found Perl: /usr/bin/perl (found version "5.34.0")
-- SDL3_image backends:
-- - enabled:  stb bmp gif jpg lbm pcx png pnm qoi svg tga xcf xpm xv
-- - disabled: imageio wic avif jxl tif webp
-- Configuring done (0.4s)
CMake Error in CMakeLists.txt:
  IMPORTED_IMPLIB not set for imported target "SDL3::SDL3-shared".


CMake Error in CMakeLists.txt:
  IMPORTED_IMPLIB not set for imported target "SDL3::SDL3-shared".


CMake Error in CMakeLists.txt:
  IMPORTED_IMPLIB not set for imported target "SDL3::SDL3-shared".


-- Generating done (0.0s)
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_CXX_COMPILER


CMake Generate step failed.  Build files cannot be regenerated correctly.

I also wanted to try this for the latest libSDL3_image. But unfortunately this is acknowledged with the following error

The one you built has debug symbols, which makes it much larger.

Can you please report this as an issue?
New Issue · libsdl-org/SDL_image (github.com)

It must be on my PC, I just tried it on the laptop and it ran without any errors.

Jetzt läuft es auch auf dem PC habe das commit von SDL3 aktualisiert und neu installiert. Anscheinend war etwas dort nicht in Ordnung.
Somit hat SDL3_image keinen Bug.