Stuff like this drives me crazy.Â Once upon a time everything was statically linked, there were no DLL’s, and all exe’s had a lot of the same code in them, and people realized that the majority of a hard disk could literally contain the same thing over and over.Â Not to mention that if you were to fix some bug in say, LIBC you would have to re-compile everything.Â So we entered the brave new world of dynamic linking where we now live in the proverbial DLL hell, that although we did save space, we have things where slight variations in the same DLL can break things in unforeseen ways.Â People have tried various things such as weak linking, Side by side assemblies, Frameworks, and all kinds of things to try to keep things together.
Honestly it’s just easier to go back, and statically link things, and just re-build as needed.
common culprits of MinGW based stuff always include:
The hard one is the pthread library.Â If you try to link it statically it’ll try to link everything else statically and not every DLL can link statically (SDL* keep reading).Â But GCC / Binutils does have the option to turn various features on and off through the link string
-static-libstdc++ -static-libgcc -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic
As you can see, everything after “-Wl,-Bstatic” will be linked statically, while everything after “-Wl,-Bdynamic” will go back to being dynamically linked.
Ok, that is great but what about SDL, you may ask.Â Well sure it’s a DLL, but even DLL’s come from somewhere.Â Download the source, build it yourself and you can directly link the objects that make up the DLL.Â In version 1.2.15 they live in the .libs directory.
And on Windows, if you get weird errors like:
SDL_dx5events.o: In function `DX5_DInputInit’:
SDL-1.2.15/./src/video/windx5/SDL_dx5events.c:183: undefined reference to `IID_IDirectInputDevice2A’
Just add theÂ -ldxguid library and you can link this too.Â I’m sure once upon a time people may not have had DirectX 5 or higher, but this isn’t 1997.
And please at least test your programs with no path, so that way you are aware of what is needed for re-distribution.
It gets so old when people never test.Â And people freak out trying to download DLL’s from weird sites, and you know that never ends well.
Oh yeah, and a static version of DOSBox is 4MB.
I know that was massive a long long time ago, but today?