Shpoike / Quakespasm

Extra bloaty junk to modernise stuff a bit.
http://triptohell.info/moodles/qss/
GNU General Public License v2.0
184 stars 41 forks source link

What is with weird SDL version check? #116

Closed etosan closed 5 months ago

etosan commented 1 year ago

What is the issue with weird SDL version check?

Are not future/newer SDL version releases backwards compatible?

After recent system update my build started dying on me with following error:

Found SDL version 2.24.0

ERROR-OUT BEGIN

QUAKE ERROR: Your version of SDL library is incompatible with me.
You need a library version in the line of 2.0.0

2.24.0 is not that far from 2.0.0 why die in such case?

Quickly removing the check, allowed me to start the binary and it seems to be working:

diff --git a/quakespasm/Quake/main_sdl.c b/quakespasm/Quake/main_sdl.c
index 9284af3a..ce0d9571 100644
--- a/quakespasm/Quake/main_sdl.c
+++ b/quakespasm/Quake/main_sdl.c
@@ -74,11 +74,11 @@ static void Sys_InitSDL (void)
        {       /*reject running under older SDL versions */
                Sys_Error("You need at least v%d.%d.%d of SDL to run this game.", SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z);
        }
-       if (SDL_VERSIONNUM(sdl_version->major,sdl_version->minor,sdl_version->patch) >= SDL_NEW_VERSION_REJECT)
-       {       /*reject running under newer (1.3.x) SDL */
-               Sys_Error("Your version of SDL library is incompatible with me.\n"
-                         "You need a library version in the line of %d.%d.%d\n", SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z);
-       }
+//     if (SDL_VERSIONNUM(sdl_version->major,sdl_version->minor,sdl_version->patch) >= SDL_NEW_VERSION_REJECT)
+//     {       /*reject running under newer (1.3.x) SDL */
+//             Sys_Error("Your version of SDL library is incompatible with me.\n"
+//                       "You need a library version in the line of %d.%d.%d\n", SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z);
+//     }

        if (SDL_Init(0) < 0)
        {

What would be the official approach?

ericwa commented 1 year ago

The SDL version numbers jumped from 2.0.22 to 2.24.0 earlier this year without breaking ABI (https://github.com/libsdl-org/SDL/tags).

Code like this dates from when SDL 1.2 was the stable release and 1.3 was going to be an ABI break (what eventually became SDL2).

The advice from the SDL maintainer, as I interpret it, is to remove this kind of version checking: https://discourse.libsdl.org/t/sdl-2-23-1-pre-release/37219/8

etosan commented 1 year ago

So, do you think is it safe to remove these checks in Quakespasm engine family?

ericwa commented 1 year ago

I think so yeah

olof-nord commented 5 months ago

Any advice on how to disable this check without having access to the source code? Are there any environment variables or startup flags which can be used?

Started initial process 3713 from gamemoderun ./quakespasm-spiked-linux64
Start monitoring process.

ERROR-OUT BEGIN

QUAKE ERROR: Your version of SDL library is incompatible with me.
You need a library version in the line of 2.0.0

Command line: ./quakespasm-spiked-linux64
Found SDL version 2.28.5
Monitored process exited.
Initial process has exited (return code: 256)
All processes have quit
Exit with return code 256
ericwa commented 5 months ago

SDL 2.28.5 has a SDL_LEGACY_VERSION hint that spoofs the version returned by SDL_GetVersion to work around broken checks like this.

https://github.com/libsdl-org/SDL/blob/release-2.28.5/src/SDL.c#L522

I think you can set the hint via an environment variable like SDL_LEGACY_VERSION=1 ./quakespasm-spiked-linux64.

Also closing this issue as the version checks were removed from QS/QSS almost 2 years ago.