ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Thu Mar 30, 2017 6:49 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu May 22, 2014 4:32 pm 
Offline
Thalore

Joined: Tue Feb 28, 2012 6:36 am
Posts: 148
The official Linux builds posted by DarkGod on te4.org currently dynamically link with a pre-2.0-release SDL2 Mercurial snapshot. Between when this snapshot was taken and the official SDL2 release, some visible function names have changed which are starting to cause issues with some Linux users.

Since SDL2 has been officially released, many major Linux distributions are now offering libsdl2 / libsdl2_image / libsdl2_ttf packages. These packages have a stable API, and this API is not 100% compatible with the API present in DarkGod's SDL2 2.0.0-beta Mercurial snapshot. If a user already has these SDL2 libraries installed by their package manager, and these libraries are found by the system before the libraries supplied by DarkGod, t-engine will choke.

I see two solutions to this problem. One is for DarkGod to statically link SDL2 with t-engine. The other is for DarkGod to update his SDL2 libraries to a stable release and do a clean rebuild of t-engine linking against the new libraries. This would let users use their system-supplied SDL2 libraries over those supplied in the t-engine distribution without an API clash.

Note that these function name changes do not require any immediate changes to the te4 code base. The old functions now exist as macros calling the new functions. Only a fresh set of SDL2 libraries/headers and a clean t-engine build are needed.

Relevant SDL2 API change for reference


Top
 Profile  
 
PostPosted: Thu May 22, 2014 4:49 pm 
Offline
Spiderkin

Joined: Wed Aug 22, 2012 4:41 pm
Posts: 481
> Note that these function name changes do not require any immediate changes to the te4 code base
hold on, but t-engine always required a separate sdl to build and never shipped it's own sdl headers/libs. or did it? if it did not, then why simple update of installed sdl libraries makes them incompatible(you told earlier that they provide macros wrapping for previous api version)?


Top
 Profile  
 
PostPosted: Fri May 23, 2014 7:05 am 
Offline
Thalore

Joined: Tue Feb 28, 2012 6:36 am
Posts: 148
It's a question of which function calls are visible in the shared object. The old pre-release libraries that DG provides in the 1.0.0->1.1.5 official releases have SDL_MutexP and SDL_MutexV exposed as functions. Newer, officially released SDL2 libraries have SDL_LockMutex and SDL_UnlockMutex functions exposed in the shared object. So, you can't just drop in a newer shared object since there is an API clash. T-Engine expects to find SDL_mutexP/mutexV functions dynamically. They are not present in the system libs, so t-engine crashes.

Now if t-engine is rebuilt against new headers, the existing t-engine SDL_mutexP/V calls would be turned into SDL_Lock/UnlockMutex function calls by the macros supplied by SDL. If new headers are not used, even if t-engine's codebase uses SDL_Lock/UnlockMutex directly, the issue is still the same! In the old headers/libs that DG uses, SDL_Lock/UnlockMutex calls were macros converted to mutexP/V function calls. There could be more instances of API conflicts like this, as there were a lot of commits between DG's libsdl2 revision and the official 2.0.0 release.

Code:
$ nm -D t-engine4-linux64-1.2.0test11/lib64/libSDL2-2.0.so.0 | less
...
0000000000012e30 T SDL_LockAudio
0000000000012df0 T SDL_LockAudioDevice
0000000000096e00 T SDL_LockSurface        (no LockMutex)
0000000000042630 T SDL_LockTexture
...
000000000003ac10 t SDL_MouseQuit
00000000000b81b0 T SDL_mutexP             *
00000000000b8160 T SDL_mutexV             *
0000000000012790 t SDL_NextAudioFormat
...

Code:
$ nm -D /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so | less
...
0000000000044730 T SDL_LockAudio
0000000000044740 T SDL_LockAudioDevice
00000000000451b0 T SDL_LockMutex          *
0000000000045d90 T SDL_LockSurface
0000000000045570 T SDL_LockTexture
...
0000000000044720 T SDL_MixAudioFormat
0000000000044bb0 T SDL_MouseIsHaptic
0000000000044b60 T SDL_NumHaptics         (no mutexP/V)
0000000000044da0 T SDL_NumJoysticks
...


Top
 Profile  
 
PostPosted: Fri May 23, 2014 8:10 am 
Offline
Master of Eyal

Joined: Wed Jul 24, 2002 9:26 pm
Posts: 10056
Location: Angolwen
fixed thanks

_________________
[tome] joylove: You can't just release an expansion like one would release a Kraken XD


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group