Hi there,
I am an happy user of SDL 2. I am planning to dev a little game. I have
wrote a test program much like testspriteminimal to try things, learn a
bit and enjoy watching a Lemming bashing again and again
With the last tarball (SDL-2.0.0-7392) I have a segfault when running my
code.
With a slightly older one (SDL-2.0.0-7353) my code run well.
gdb with my code says show a not so cool stack strace :
Starting program: /home/lpouzenc/Bureau/mplemmings/sbsprite
[Thread debugging using libthread_db enabled]
Using host libthread_db library â/lib/i386-linux-gnu/libthread_db.so.1â.
Program received signal SIGSEGV, Segmentation fault.
0xb7d8ca13 in ?? () from /lib/i386-linux-gnu/libc.so.6
(gdb) up
#1 0xb7d8ed28 in malloc () from /lib/i386-linux-gnu/libc.so.6
(gdb) up
#2 0xb7f45c0b in SDL_malloc (size=size at entry=776)
at /home/lpouzenc/Bureau/SDL-2.0.0-7392/src/stdlib/SDL_malloc.c:31
31 return malloc(size);
(gdb) up
#3 0xb7f46c04 in SDL_GetErrBuf () at /home/lpouzenc/Bureau/SDL-2.0.0-7392/src/thread/SDL_thread.c:57
57 errbuf = (SDL_error *)SDL_malloc(sizeof(*errbuf));
(gdb) up
#4 0xb7eebd53 in SDL_SetError (fmt=fmt at entry=0xb7faf790 âParameter â%sâ is invalidâ)
at /home/lpouzenc/Bureau/SDL-2.0.0-7392/src/SDL_error.c:62
62 error = SDL_GetErrBuf();
(gdb) up
#5 0xb7fab046 in SDL_TLSSet (id=1, value=value at entry=0xa77a128)
at /home/lpouzenc/Bureau/SDL-2.0.0-7392/src/thread/pthread/SDL_systls.c:75
75 return SDL_InvalidParamError(id);
(gdb) up
#6 0xb7f46c34 in SDL_GetErrBuf () at /home/lpouzenc/Bureau/SDL-2.0.0-7392/src/thread/SDL_thread.c:62
62 SDL_TLSSet(tls_errbuf, errbuf);
(gdb) up
#7 0xb7eebd53 in SDL_SetError (fmt=fmt at entry=0xb7faf790 âParameter â%sâ is invalidâ)
at /home/lpouzenc/Bureau/SDL-2.0.0-7392/src/SDL_error.c:62
62 error = SDL_GetErrBuf();
(gdb) up
#8 0xb7fab046 in SDL_TLSSet (id=1, value=value at entry=0xa779e18)
at /home/lpouzenc/Bureau/SDL-2.0.0-7392/src/thread/pthread/SDL_systls.c:75
75 return SDL_InvalidParamError(id);
(gdb) up
#9 0xb7f46c34 in SDL_GetErrBuf () at /home/lpouzenc/Bureau/SDL-2.0.0-7392/src/thread/SDL_thread.c:62
62 SDL_TLSSet(tls_errbuf, errbuf);
(gdb) up
#10 0xb7eebd53 in SDL_SetError (fmt=fmt at entry=0xb7faf790 âParameter â%sâ is invalidâ)
at /home/lpouzenc/Bureau/SDL-2.0.0-7392/src/SDL_error.c:62
62 error = SDL_GetErrBuf();
(gdb) up
#11 0xb7fab046 in SDL_TLSSet (id=1, value=value at entry=0xa779b08)
at /home/lpouzenc/Bureau/SDL-2.0.0-7392/src/thread/pthread/SDL_systls.c:75
75 return SDL_InvalidParamError(id);
(gdb) up
#12 0xb7f46c34 in SDL_GetErrBuf () at /home/lpouzenc/Bureau/SDL-2.0.0-7392/src/thread/SDL_thread.c:62
62 SDL_TLSSet(tls_errbuf, errbuf);
(gdb) up
#13 0xb7eebd53 in SDL_SetError (fmt=fmt at entry=0xb7faf790 âParameter â%sâ is invalidâ)
at /home/lpouzenc/Bureau/SDL-2.0.0-7392/src/SDL_error.c:62
62 error = SDL_GetErrBuf();
(gdb) up
#14 0xb7fab046 in SDL_TLSSet (id=1, value=value at entry=0xa7797f8)
at /home/lpouzenc/Bureau/SDL-2.0.0-7392/src/thread/pthread/SDL_systls.c:75
75 return SDL_InvalidParamError(id);
(gdb) up
I have reduced to the smaller code that trigger the segfault on my system :
#include <SDL.h>
int main(int argc, char *argv[]) {
int res;
res=SDL_Init(0);
return res;
}
I have tried other values that 0 to SDL_Init() : same results. Segfault.
I have compiled this code with :
gcc -DHAVE_CONFIG_H -I. -D_REENTRANT -I/usr/local/include/SDL2 -g -O2 -MT src/sandbox/sprite.o -MD -MP -MF $depbase.Tpo -c -o src/sandbox/sprite.o src/sandbox/sprite.c &&
mv -f $depbase.Tpo $depbase.Po
gcc -D_REENTRANT -I/usr/local/include/SDL2 -g -O2 -o sbsprite src/sandbox/sprite.o -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lSDL2 -lpthread
(automake generated stuffâŚ)
Am I out of the specs or there is a bug in SDL2 ?
Cheers,
Ludovic Pouzenc