SDL1 no longer compiles

Discussion around programming R'n'D, its source code and its tools.

Moderators: Flumminator, Zomis

Post Reply
filbo
Posts: 647
Joined: Fri Jun 20, 2014 10:06 am

SDL1 no longer compiles

Post by filbo »

Whenever I pull new changes from you, I always make SDL1 and SDL2 binaries. Today's pull has broken SDL1 builds:

Code: Select all

$ make sdl RO_GAME_DIR=/usr/share/games/rocksndiamonds RW_GAME_DIR=/var/games/rocksndiamonds
gcc -DDEBUG -g -Wall -DTARGET_SDL -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DRO_GAME_DIR="\"/usr/share/games/rocksndiamonds\"" -DRW_GAME_DIR="\"/var/games/rocksndiamonds\"" -c system.c
system.c: In function 'InitVideoDisplay':
system.c:382:3: warning: implicit declaration of function 'SDLSetDisplaySize' [-Wimplicit-function-declaration]
gcc -DDEBUG -g -Wall -DTARGET_SDL -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DRO_GAME_DIR="\"/usr/share/games/rocksndiamonds\"" -DRW_GAME_DIR="\"/var/games/rocksndiamonds\"" -c sdl.c
sdl.c: In function 'SDLCreateScreen':
sdl.c:571:3: warning: implicit declaration of function 'SDLSetScreenSizeAndOffsets' [-Wimplicit-function-declaration]
sdl.c: At top level:
sdl.c:2688:13: warning: 'DrawTouchInputOverlay' defined but not used [-Wunused-function]
gcc main.o conf_gfx.o conf_snd.o conf_mus.o conf_hlp.o init.o config.o events.o tools.o screens.o game.o editor.o files.o tape.o anim.o network.o netserv.o libgame/libgame.a game_em/game_em.a game_sp/game_sp.a -lSDL_image -lSDL_mixer -lSDL_net -L/usr/lib/x86_64-linux-gnu -lSDL -lm -o ../rocksndiamonds
libgame/libgame.a(system.o): In function `InitVideoDisplay':
/usr/share/games/rocksndiamonds/downloads/src/rocksndiamonds-git/rocksndiamonds/src/libgame/system.c:382: undefined reference to `SDLSetDisplaySize'
libgame/libgame.a(sdl.o): In function `SDLCreateScreen':
/usr/share/games/rocksndiamonds/downloads/src/rocksndiamonds-git/rocksndiamonds/src/libgame/sdl.c:571: undefined reference to `SDLSetScreenSizeAndOffsets'
collect2: ld returned 1 exit status
make[1]: *** [../rocksndiamonds] Error 1
make[1]: Leaving directory `/usr/share/games/rocksndiamonds/downloads/src/rocksndiamonds-git/rocksndiamonds/src'
make: *** [sdl] Error 2
This exercise also reminds me that every pull, I have to reapply this small patch which (I think) I sent you but was never applied:

Code: Select all

$ git diff
diff --git a/src/events.c b/src/events.c
index 0aa4185a..46cb5970 100644
--- a/src/events.c
+++ b/src/events.c
@@ -1418,7 +1418,7 @@ void HandleKeysDebug(Key key)
 	  (mod_key_pressed == setup.debug.frame_delay_use_mod_key))
       {
 	GameFrameDelay = (GameFrameDelay != setup.debug.frame_delay[i] ?
-			  setup.debug.frame_delay[i] : GAME_FRAME_DELAY);
+			  setup.debug.frame_delay[i] : setup.game_frame_delay);
 
 	if (!setup.debug.frame_delay_game_only)
 	  MenuFrameDelay = GameFrameDelay;
-- which causes the ctrl-# debug speed toggles to toggle between frame_delay and your setup saved speed, rather than an irrelevant constant.
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: SDL1 no longer compiles

Post by Holger »

Whenever I pull new changes from you, I always make SDL1 and SDL2 binaries. Today's pull has broken SDL1 builds:
Oops. Indeed. Fixed.
This exercise also reminds me that every pull, I have to reapply this small patch which (I think) I sent you but was never applied:
Oops. Indeed. Fixed.

:-D

Please "git pull" again!
filbo
Posts: 647
Joined: Fri Jun 20, 2014 10:06 am

Re: SDL1 no longer compiles

Post by filbo »

Ok! Builds, no warnings, both SDL1 and SDL2 run, speed fix is good :)

SDL2 continues to not play MP3 (and is not linked with -lsmpeg). Remind me what I might need to do to make this go -- is it an unset flag in how the SDL2 libs I'm using are built? (Using ppa:zoogie/sdl2-snapshots for precise)
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: SDL1 no longer compiles

Post by Holger »

Ok! Builds, no warnings, both SDL1 and SDL2 run, speed fix is good :)
Great! :)
SDL2 continues to not play MP3 (and is not linked with -lsmpeg). Remind me what I might need to do to make this go -- is it an unset flag in how the SDL2 libs I'm using are built? (Using ppa:zoogie/sdl2-snapshots for precise)
Yes, there's no "-lsmpeg" anymore, as SDL2_mixer dynamically loads that library on demand (if MP3s have to be played). Therefore, there should be a file "libsmpeg2.so" somewhere in your library path (probably in the same directory where "libSDL2_mixer.so" lives).

When looking at "https://launchpad.net/~zoogie/+archive/ ... -snapshots", it indeed seems that there's just no support for "smpeg2" (at least not as a separate library/package). The only other explanation would be that "smpeg2" was compiled into SDL2_mixer, but does not work for unknown reason.

If the pre-compiled packages just have no MP3 support, it's usually best to just install SDL2 and libraries from source.
Post Reply