Hey everyone… I’m at my wits end here, so I thought I’d post here and
see if anyone could help.
I’m developing a game using SDL. I was developing on Slackware Linux
using home-compiled SDL 1.2.13 with no problems for a good 2 months.
Recently I’ve changed my operating system to Ubuntu, and that’s when the
problems for my app began.
Using Ubuntu’s SDL libs (also 1.2.13) and I got this very strange
problem when attempting to blit surfaces with alpha channels:
http://www.randomlynx.net/temp/sdl.png
The center window should be shaded grey with an alpha of 127, instead I
get the green stripy effect.
I actually had a copy of libSDL-1.2.so.0 left over from my Slackware
build (1.5MB in size instead of Ubuntu’s 0.5MB), and if I ran my game
against it, there was no visual glitch.
Figuring this might be an Ubuntu lib issue, I decided to give up and
directly compile libSDL on my own… and that’s when things got worse.
My app, now with an LD_LIBRARY_PATH of /usr/local/lib, gave a segfault
every time it ran. GDB reports the following:
trevor at pergamon:~/Projects/GalacticArtifact/trunk$ export
LD_LIBRARY_PATH=/usr/local/lib/
trevor at pergamon:~/Projects/GalacticArtifact/trunk$ gdb ./GalacticArtifact
GNU gdb 6.8-debian
Copyright © 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type “show copying”
and “show warranty” for details.
This GDB was configured as “i486-linux-gnu”…
(gdb) r
Starting program:
/home/trevor/Projects/GalacticArtifact/trunk/GalacticArtifact
[Thread debugging using libthread_db enabled]
[New Thread 0xb7ae36d0 (LWP 28193)]
[New Thread 0xb7ae2b90 (LWP 28196)]
bt
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7ae36d0 (LWP 28193)]
SDL_Flip (screen=0x0) at ./src/video/SDL_video.c:1087
1087 if ( screen == SDL_ShadowSurface ) {
(gdb) bt
#0 SDL_Flip (screen=0x0) at ./src/video/SDL_video.c:1087
#1 0x08096da9 in ScreenSurface::flip ()
#2 0x080b9a1b in startClient ()
#3 0x080bcae2 in main ()
If I set my LD_LIBRARY_PATH back to /usr/lib, the program runs and has
the visual glitches I mentioned before.
Figuring my program was complicating things, I decided that reducing the
program to the smallest size would be the way to go… it turns out
simply invoking SDL_Flip causes the same error! For instance, the
following simple program also generates the same SDL_Video.c error at
line 1087:
#include “SDL/SDL.h”
#define SCREEN_WIDTH 800
#define SCREEN_HEIGHT 600
#define SCREEN_CENTER 300
#define SCREEN_DEPTH 16
int main(int argc, char *argv[]) {
SDL_Surface *screen;
SDL_Event event;
SDL_Init(SDL_INIT_VIDEO);
screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_DEPTH,
SDL_SWSURFACE);
SDL_Flip(screen);
}
gdb Backtrace says SDL_Flip is causing the segfault.
I’ve not done anything special installing SDL… your standard
tar zxfv SDL-1.2.13.tar.gz ; ./configure; make; sudo make install
I’m at my wits end here trying to solve this problem… I’d appreciate
any help anyone would be able to give, either on the original alpha
glitch problem, or preferably to this SDL segfault issue.
Thanks in advance!