SDL Segfault

I’m having problems with my SDL OpenGL programs. I’m running Debian,
Nvidia 2313 and kernel 2.4.18-pre2 (didn’t work under 2.5.2-pre9
either). When I have compiled the program it just segfaults when I start
it. I have tried examples from NeHe with the same result and I know at
least they worked before. Am I the only one with this problem or are
there more people out there?

/daniel svensson

I’m having problems with my SDL OpenGL programs. I’m running Debian,
Nvidia 2313 and kernel 2.4.18-pre2 (didn’t work under 2.5.2-pre9
either). When I have compiled the program it just segfaults when I start
it.

It might be helpful if you can work out where the programs are crashing. I
actually just ran a program (Carlin’s isometric rendering thing) and had it
segfault instantly – because no video drivers were available (the screen
was therefore a NULL pointer, which caused a segfault when it was derefenced)

If you can at least isolate if it’s a problem with SDL/OGL or the program,
that’d help the SDL developers at least :wink:

Install gdb if you don’t have it yet, and compile the program with debugging
symbols enabled (-g for gcc/g++)

e.g.

g++ sdl-config --cflags -o sdltest -g main.cpp sdl-config --libs

Plus whatever else you need for ogl. Add it to the makefile or something :>

Then run it under the debugger;
mike at satan:/tmp/1$ gdb sdltest
GNU gdb 5.1
(gdb) r
Starting program: /tmp/1/sdltest
[New Thread 1024 (LWP 1085)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 1096)]
0x08049cdf in main (argc=1, argv=0xbffffb14) at main.cpp:90
90 SDL_SetColorKey(map[x][y], SDL_SRCCOLORKEY,
SDL_MapRGB(screen->format,255,0,255));
(gdb) inspect map[x][y]
$1 = (SDL_Surface *) 0x8055bd0
(gdb) inspect screen
$2 = (SDL_Surface *) 0x0
(gdb) bt
#0 0x08049cdf in main (argc=1, argv=0xbffffb14) at main.cpp:90
#1 0x4013b65f in __libc_start_main () from /lib/libc.so.6
(gdb) q
The program is running. Exit anyway? (y or n) y

Provide that info and it should give us an idea what’s going on. Of course,
if you get something like the above there’s a good chance you’ll be able to
fix the problem yourself.

Sorry if the above was stupid and condescending, it pays to be thorough
sometimes :-)On 10 Jan 2002, Daniel Svensson wrote:

Mike.