0

I just compiled a SDL2 program in MSYS2 and would like to distribute a binary copy of the program in a ZIP file.

But to run the program in "Normal" Windows I have to copy a long list of DLLs from /mingw64/bin.

Is there a better way of doing this? maybe linking statically?

How would the license work either way?

My own program is BSD 3 clause.

I'm using SDL2, SDL2_image, SDL2_ttf and all their dependencies.

HolyBlackCat
  • 78,603
  • 9
  • 131
  • 207
Dacobi
  • 417
  • 4
  • 14
  • Is the list that long actually? 1. libgcc, 2. libstdc++, 3. libwinpthread, 4. SDL2.dll - I believe? – HolyBlackCat Feb 06 '23 at 14:44
  • 1
    @HolyBlackCat I have 33 dlls, probably because of SDL2_ttf and all the freetype dlls. Would the license allow to just add them to a ZIP file? – Dacobi Feb 06 '23 at 14:47
  • 2
    I think yes. In general, licenses favor dlls over static linking, because the user can swap out a dll (LGPL for example). To be absolutely sure, you'll have to check individual licenses though. – HolyBlackCat Feb 06 '23 at 14:55
  • 1
    Definitely read the licenses of all the code you are redistributing and make sure you comply with their terms in order to get permission to redistribute the code. Most open source licenses require you to at least communicate the copyright info of the authors. – David Grayson Feb 06 '23 at 20:27

2 Answers2

1

You can build statically. The licensing situation in your case makes no difference between static/dynamic linkage.

I'm not sure how you build but here is an example with CMake: CMake - Compile in Linux, Execute in Windows (In the example the binary is cross-compiled but the static stuff is the same for native compilation as well).

ypnos
  • 50,202
  • 14
  • 95
  • 141
  • I tried adding the static parts of the example you linked to my CMakeLists.txt, but all the SDL2 libs fail with undefined references. – Dacobi Feb 06 '23 at 15:51
  • Yes, you need to use static builds of your dependencies, and sometimes you need to manually intervene for them to be picked up. Probably need to change how you link SDL to the static counterparts. Typically if you build SDL it will build both static and dynamic object files IIRC. – ypnos Feb 06 '23 at 17:41
0

I just found out that all library licenses are located in /mingw64/share/licenses

So it's pretty easy to copy the needed licenses to the ZIP file.

Dacobi
  • 417
  • 4
  • 14