How to compile with sdl264.dll using a different name?

My project is using a customized fork of ioquake3, so all the executable files and renderer file names have been changed, but sdl264.dll is being a thorn. I’ve tried changing the name in the makefile and in libs subfolder, and it creates the renamed file when running Make in Msys2 Mingw64, but loading the game errors with this error:

image

I cannot find any explicit references to sdl264.dll outside of the makefile searching the repository, so I have no idea where this is being called from during program execution.

As for why I want to rename this file… If my build is placed in the same Quake 3 Arena install folder as IOQuake3’s binaries it’s going to overwrite the included sdl264.dll. I want my binaries to respect IOQuake3’s and not overwrite a file IOQuake3 relies on. Any thoughts on why this is being hard linked and how to change it?

SDL264.dll name is embedded in the import library; libSDL264.dll.a (MinGW) and SDL264.lib (MSVC). I’m not sure how to change it without recompiling SDL. (Though I haven’t looked into it very much.)

SDL264 isn’t an official name so ioquake3’s 64-bit dll is basically built with:

cd SDL2
mkdir build
cd build
../configure
sed -i -s "s/libSDL2/libSDL264/g" Makefile
make

You could change “libSDL264” to “libGenerations-SDL264” or something.

The script I used to build the current Windows/macOS libraries (SDL 2.24) is at Scripts for building SDL 2 libraries for Windows (MinGW, MSVC) and macOS. · GitHub. (The shell script is for Linux but the MinGW part probably works on MSYS2.)

It would be possible to change ioquake3 to dynamically load SDL functions with Sys_LoadLibrary() instead of using the import library. It’s a little bit of work to list all the SDL functions that ioquake3 uses and load them like the OpenGL functions. It would probably be nice not to have to build SDL264 import libraries specifically for ioquake3. (And allow you to easily rename it.) Though I don’t know if other people agree with this change.

1 Like

So if I’m understanding this right, IOQuake3 reads the name sdl264.dll from within libsSDL264.dll.a during make ARCH=x86_64, which gets compiled into ioquake.x86_64.exe, and that’s how the file name is being baked into the executable?

Yeah. The renderer also links to libSDL264.dll.a directly and requires SDL264.dll.

I managed to get the SDL264 library to compile, with a few caveats:

I downloaded https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.28.5.zip
unzipped to c:/SDL2
Ran MSys2

cd /c/
cd SDL2
mkdir build
cd build
./configure
sed -i -s “s/libSDL2/libgenSDL264/g” Makefile
make

Worked beautifully, except the genSDL264 file is 14995K in size as opposed to 1303K.

My build script also runs x86_64-w64-mingw32-strip -x *.dll *.a (I’m not sure the path as the build uses configure --prefix and make install). It removes unneeded symbols and reduces size. It’s a different SDL version so the size may be different.

As long as it works I’m good with it.

Edit: Figured out how to get the strip command working in Msys2 after studying that script a bit further. File size decreased to 2441KB. Works great. Much appreciated.