Its been a little while since I used SDL. I have Ubuntu 13.04 and have just installed SDL 2.0. I have written a small program to check the version of SDL to make sure this is installed. Yet when I go to run any other program using SDL even just trying to intitialise the video. I get a “Segmentation fault (core dumped)” error". Must something silly I am doing, I am using gcc to compile the program.
Can you explain a little more about the setup you have? Specifically:
- The method you went about building and installing SDL2
- The test program you wrote, and the results
- Elaborate on “other program using SDL”; are these designed for use with
SDL2 or with bog-standard SDL 1.2? If the latter, are you forcing them to
build with SDL2? Are they just SDL 1.2 programs that stopped working?On 13 July 2013 19:26, dosh wrote:
**
Its been a little while since I used SDL. I have Ubuntu 13.04 and have
just installed SDL 2.0. I have written a small program to check the version
of SDL to make sure this is installed. Yet when I go to run any other
program using SDL even just trying to intitialise the video. I get a
“Segmentation fault (core dumped)” error". Must something silly I am doing,
I am using gcc to compile the program.
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
I Downloaded the latest version and unpacked it.
Went to the directory I unpacked it to.
Then ran the following commands
bash autogen.sh
./configure
sudo make-install
sudo install
sudo make
Wrote code below to test version of SDL installed.
Code:
#include <stdio.h>
#include <stdlib.h>
#include “SDL2/SDL.h”
int
main(int argc, char *argv[])
{
SDL_version compiled;
SDL_version linked;
#if SDL_VERSION_ATLEAST(2,0,0)
printf(“2.0”);
#else
printf(“Other”);
#endif
printf("\ntest");
return (0);
}
Compiled it.
Ran it. It returned 2.0
Then wrote a simple SDL test program.
Code:
#include “SDL2/SDL.h”
#include <stdio.h>
int main(int argc, char* argv[]){
SDL_Init(0);
atexit(SDL_Quit);
return 0;
}
Compiled it using
gcc ‘/home/philip/example.c’ -o ‘/home/philip/example’ sdl2-config --cflags --libs
no errors
Ran it.
result -error
Segmentation fault (core dumped)
For what it’s worth, the first program doesn’t actually test the installed
library at runtime, it’s calling a macro at compile time to check the
version number in the header file.
Could you run your second test app in gdb and provide a backtrace of the
crash?On 14 July 2013 19:41, dosh wrote:
**
I Downloaded the latest version and unpacked it.
Went to the directory I unpacked it to.
Then ran the following commandsbash autogen.sh
./configure
sudo make-install
sudo install
sudo makeWrote code below to test version of SDL installed.
Code:
#include **
#include **#include “SDL2/SDL.h”
int
main(int argc, char *argv)
{
SDL_version compiled;
SDL_version linked;#if SDL_VERSION_ATLEAST(2,0,0)
printf(“2.0”);
#else
printf(“Other”);
#endifprintf(“\ntest”);
return (0);
}Compiled it.
Ran it. It returned 2.0Then wrote a simple SDL test program.
Code:
#include “SDL2/SDL.h”
#include **int main(int argc, char* argv){
SDL_Init(0);
atexit(SDL_Quit);
return 0;
}
Compiled it using
gcc ‘/home/philip/example.c’ -o ‘/home/philip/example’sdl2-config --cflags --libs
no errors
Ran it.
result -error
Segmentation fault (core dumped)
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Sorry I’ve never used gdb before. Instructions on use?
Scott Percival wrote:> For what it’s worth, the first program doesn’t actually test the installed library at runtime, it’s calling a macro at compile time to check the version number in the header file.
Could you run your second test app in gdb and provide a backtrace of the crash?
On 14 July 2013 19:41, dosh <@dosh (@dosh)> wrote:
I Downloaded the latest version and unpacked it.
Went to the directory I unpacked it to.
Then ran the following commandsbash autogen.sh
./configure
sudo make-install
sudo install
sudo makeWrote code below to test version of SDL installed.
Code: #include
#include
#include “SDL2/SDL.h”
int
main(int argc, char *argv)
{
? ? SDL_version compiled;
? ? SDL_version linked;? ? #if SDL_VERSION_ATLEAST(2,0,0)
printf(“2.0”);
#else
printf(“Other”);
#endif
? ?
printf(“\ntest”);
? ? return (0);
}Compiled it.
Ran it. It returned 2.0Then wrote a simple SDL test program.
Code:
#include “SDL2/SDL.h”
#includeint main(int argc, char* argv){
?
? SDL_Init(0);
? ?
? ? atexit(SDL_Quit);
? ?
? return 0;? ?
?
}Compiled it using
gcc ‘/home/philip/example.c’ -o ‘/home/philip/example’sdl2-config --cflags --libs
no errors
Ran it.
result -error
Segmentation fault (core dumped)
SDL mailing list
SDL at lists.libsdl.org (SDL at lists.libsdl.org)
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org (http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)
gdb ← start gdb from the command line
r ← run (up to the next breakpoint or crash)
bt ← backtrace
q ← quit
If you need more info, try the “help” command within gdb.On 15.07.2013 11:17, dosh wrote:
Sorry I’ve never used gdb before. Instructions on use?
–
Rainer Deyke (rainerd at eldwood.com)
Output
as below
(gdb) r
Starting program: /home/philip/example
[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.
0xb7dbda1a in ?? () from /lib/i386-linux-gnu/libc.so.6
(gdb) bt
#0 0xb7dbda1a in ?? () from /lib/i386-linux-gnu/libc.so.6
#1 0xb7dbfd28 in malloc () from /lib/i386-linux-gnu/libc.so.6
#2 0xb7f705db in SDL_malloc (size=size at entry=776)
at /home/philip/Downloads/SDL2-2.0.0/src/stdlib/SDL_malloc.c:31
#3 0xb7f715d4 in SDL_GetErrBuf ()
at /home/philip/Downloads/SDL2-2.0.0/src/thread/SDL_thread.c:57
#4 0xb7f1b6b3 in SDL_SetError (
fmt=fmt at entry=0xb7fb96b0 “Parameter ‘%s’ is invalid”)
at /home/philip/Downloads/SDL2-2.0.0/src/SDL_error.c:62
#5 0xb7fb4f66 in SDL_TLSSet (id=1, value=value at entry=0xa779748)
at /home/philip/Downloads/SDL2-2.0.0/src/thread/pthread/SDL_systls.c:75
#6 0xb7f71604 in SDL_GetErrBuf ()
at /home/philip/Downloads/SDL2-2.0.0/src/thread/SDL_thread.c:62
#7 0xb7f1b6b3 in SDL_SetError (
fmt=fmt at entry=0xb7fb96b0 “Parameter ‘%s’ is invalid”)
at /home/philip/Downloads/SDL2-2.0.0/src/SDL_error.c:62
#8 0xb7fb4f66 in SDL_TLSSet (id=1, value=value at entry=0xa779438)
at /home/philip/Downloads/SDL2-2.0.0/src/thread/pthread/SDL_systls.c:75
#9 0xb7f71604 in SDL_GetErrBuf ()
at /home/philip/Downloads/SDL2-2.0.0/src/thread/SDL_thread.c:62
#10 0xb7f1b6b3 in SDL_SetError (
fmt=fmt at entry=0xb7fb96b0 “Parameter ‘%s’ is invalid”)
at /home/philip/Downloads/SDL2-2.0.0/src/SDL_error.c:62
Rainer Deyke wrote:> On 15.07.2013 11:17, dosh wrote:
Sorry I’ve never used gdb before. Instructions on use?
gdb ← start gdb from the command line
r ← run (up to the next breakpoint or crash)
bt ← backtrace
q ← quitIf you need more info, try the “help” command within gdb.
–
Rainer Deyke (rainerd at eldwood.com)
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
#3 0xb7f715d4 in SDL_GetErrBuf ()
at /home/philip/Downloads/SDL2-2.0.0/src/thread/SDL_thread.c:57
#4 0xb7f1b6b3 in SDL_SetError (
fmt=fmt at entry=0xb7fb96b0 “Parameter ‘%s’ is invalid”)
at /home/philip/Downloads/SDL2-2.0.0/src/SDL_error.c:62
#5 0xb7fb4f66 in SDL_TLSSet (id=1, value=value at entry=0xa779748)
at /home/philip/Downloads/SDL2-2.0.0/src/thread/pthread/SDL_systls.c:75
This looks like the same SDL_TLSSet/SDL_SetError/SDL_GetErrBuf infinite
recursion bug that has already affected several people here. It should
be fixed in the latest Mercurial.On 15.07.2013 12:27, dosh wrote:
–
Rainer Deyke (rainerd at eldwood.com)
What is the correct way to uninstall SDL then? So I can reload it.
I would just build the latest SDL version and install it. That will
overwrite the previous version.
2013/7/20, dosh :> What is the correct way to uninstall SDL then? So I can reload it.
Hi,
I know this thread is old but it may help someone … Try resetup your compiler options, because it may make the game not working by this error. For example follow some video and it will help you.