The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL2 does not initialize at all and throws a SIGSEGV stoppin
Devesh Sawant
Guest

SDL2 is a completely fantastic library and i'm still learning the
intricacies of programming.
I'm writing a snake game since quite some time.Note that before the
forthcoming problem came up SDL initialised the video library
successfully and rendered the game properly, only catch was when I
exited it threw a SIGSEGV at the destroy functions.
I had written an init function almost same as the one given in
lazyfoos tutorial that init the Renderer and Window.However, after
investigating the issue in gdb, it never initialises. SDL_init is
called but it never returns and throws SIGSEGV .


'''
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7b227cd in SDL_DestroyRenderer_REAL (renderer=0x7) at
/home/devesh/downloads/SDL2-2.0.3/src/render/SDL_render.c:1841
1841 CHECK_RENDERER_MAGIC(renderer, );
'''
I don't understand how did it jump to the SDL_DestroyRenderer function
straight from SDL_init.
Checked the macro and found out this usage it is deliberate. So it's
not a bug. right?
I apologise for such a writeup, this problem has irking me for long.
Do I have to compile SDL from scratch as i did ?
Please do tell me if there's any more info required.
regards
Devesh
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
dfrizel


Joined: 14 Sep 2014
Posts: 7
Location: Vienna / Austria
Normally you don't have to compile SDL2 for using it. many distributions have a SDL2 library in their repositories.

What's your initialisation code?
Does the lazyfoo code work with your setup?
What does the gdb backtrace ('bt') tell you? (that will also help you understand the why)
Single stepping is also useful (sometimes)

Side note: Beginner and graphical game devolpment -> not a easy start

br