- What is supported?
- How do I add SDL to my project?
- I installed the SDL RPM, but can't compile SDL applications
- I'm using nasm 0.98 and getting a crash when linking SDL
- I installed SDL from source but can't build or run SDL applications
- I'm running Mandrake or Slackware and applications can't find SDL!
- How do I set an environment variable?
- I get the error: "no video devices available"
- I get the error: "SDL: Audio timeout - buggy audio driver? (disabled)"
- How do I disable framebuffer console acceleration?
- How do I enable DMA audio support?
- How do I turn off DGA mouse support?
- How do I enable X11 mouse acceleration?
- How do I disable XFree86 XVideo acceleration?
- How do I tell SDL to default to AALib?
- How do I tell SDL to use the DGA 2.0 video driver?
- When I specify SDL_FULLSCREEN in X11, the screen goes black and my window is centered in the middle, instead of covering the whole screen!
- How do I get all the dependencies for building SDL on Fedora?
- How do I get all the dependencies for building SDL on Ubuntu?
What is supported?
SDL supports all known Linux hardware with GNU libc and kernel version 2.6 or newer.
For the latest information see the page about Installation.
How do I add SDL to my project?
The short answer is use the output of the command "sdl-config --cflags --libs" for SDL 1.2 or "sdl2-config --cflags --libs", for example: gcc -o test test.c `sdl-config --cflags --libs`
If you are using home-grown Makefiles for your project, you can get the proper CFLAGS and LDFLAGS for SDL by adding the following lines to your Makefile:
SDL_CFLAGS := $(shell sdl-config --cflags) SDL_LDFLAGS := $(shell sdl-config --libs)
If you are using autoconf and automake for your project, you can copy the contents of 'sdl.m4' (sdl2.m4) into your acinclude.m4 file, and then add the following to your configure.in file (for SDL 1.2):
dnl Check for SDL SDL_VERSION=1.2.0 AM_PATH_SDL($SDL_VERSION, :, AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) ) CFLAGS="$CFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS"
For SDL 2.0, the AM_PATH_SDL above will be AM_PATH_SDL2 and SDL_VERSION should also be set appropriately.
I installed the SDL RPM, but can't compile SDL applications
You need to install the SDL-devel RPM, available from: http://www.libsdl.org/download.php
I'm using nasm 0.98 and getting a crash when linking SDL
There is a bug in the nasm assembler version 0.98 - the version shipped with RedHat 7.1. You should upgrade nasm to at least version 0.98.08. If for some reason you can't upgrade, you can disable the assembly code in SDL by passing "--disable-nasm" to configure when building SDL from source.
I installed SDL from source but can't build or run SDL applications
Edit the file /etc/ld.so.conf, and make sure it contains the line:
As root, run /sbin/ldconfig
Make sure /usr/local/bin is in your execution path:
Make sure that there aren't any other versions of SDL on your system, and that you have removed any file named "config.cache" from the directory of the software that refuses to build.
If all of the above still don't work, send e-mail to the SDL mailing list with the output from the following commands run from the directory of the software that refuses to build:
- which sdl-config
- sdl-config --version
- locate libSDL
- tail config.log
I'm running Mandrake or Slackware and applications can't find SDL!
You probably have a version of SDL built with aRts sound support, and the KDE libraries are not installed in a system standard location. You need to add the directory containing libartsc.so.0 to the file /etc/ld.so.conf and then run the command "ldconfig". On newer versions of Mandrake, this directory is: /opt/kde/lib
How do I set an environment variable?
How to set an environment variable depends on your login shell:
For Bourne shell derivatives: (sh, ash, ksh, zsh, bash, etc.)
VARIABLE='value'; export VARIABLE
For C shell derivatives: (csh, tcsh, etc.)
setenv VARIABLE 'value'
I get the error: "no video devices available"
SDL doesn't use the X11 video driver if it can't open the X display, and if no other drivers are available, it will report this error. To fix this, set your display environment variable appropriately:
DISPLAY=:0 ; export DISPLAY
setenv DISPLAY :0
If you still have problems, try running xhost + localhost Finally, if all those didn't work, and you built SDL from source, make sure that you have the X11 development libraries installed, otherwise you'll get a version of SDL that doesn't include X11 display support. After you install the X development libraries, you need to "make clean" and then rerun the configure and build process.
I get the error: "SDL: Audio timeout - buggy audio driver? (disabled)"
Some audio drivers don't properly implement select(). I added a hack to approximate the timing using timing functions, and you can enabled this by setting the environment variable SDL_DSP_NOSELECT to "1". You can also use ESounD or aRts as a high-latency sound server.
How do I disable framebuffer console acceleration?
As of SDL 1.0.3, you can set the environment variable SDL_FBACCEL to "0".
How do I enable DMA audio support?
As of SDL 1.0.4, you can set the environment variable SDL_AUDIODRIVER to "dma".
How do I turn off DGA mouse support?
As of SDL 1.0.8, you can set the environment variable SDL_VIDEO_X11_DGAMOUSE to "0".
How do I enable X11 mouse acceleration?
As of SDL 1.0.8, you can set the environment variable SDL_VIDEO_X11_MOUSEACCEL to "X/Y", where 'X' is the numerator and 'Y' is the denomenator of the mouse acceleration. For example, if you wanted to set mouse acceleration to 2, you would set the variable to "2/1". By default SDL does not change the current X11 mouse acceleration.
How do I disable XFree86 XVideo acceleration?
You can disable all YUV hardware acceleration by setting the environment variable SDL_VIDEO_YUV_HWACCEL to "0".
How do I tell SDL to default to AALib?
Building SDL: make distclean; ./configure --enable-video-aalib ; make install Running your app: set the environment variable SDL_VIDEODRIVER to "aalib".
How do I tell SDL to use the DGA 2.0 video driver?
Make sure that you have XFree86 4.01 or newer, run the program as root, set the environment variable SDL_VIDEODRIVER to "dga", and use a video card like the Voodoo 3000, Matrox G400, or any other card with a decent DGA driver.
When I specify SDL_FULLSCREEN in X11, the screen goes black and my window is centered in the middle, instead of covering the whole screen!
X needs to be able to switch to the desired resolution. For this to work, your monitor must support the resolution, and you need to have the resolution listed in your X server configuration.
The following example is taken from my config for XFree86 4.0.1, but 3.3.x is similar. Note that if your monitor isn't capable of using these video modes, the X server will drop these modes from the list of available video modes. Example:
Section "Screen" Identifier "Screen 1" Device "3dfx" Monitor "Samsung LCD" DefaultDepth 16 Subsection "Display" Depth 8 Modes "1280x1024" "1024x768" "800x600" "640x480" "320x240" ViewPort 0 0 EndSubsection Subsection "Display" Depth 16 Modes "1280x1024" "1024x768" "800x600" "640x480" ViewPort 0 0 EndSubsection EndSection
Note the different entries for 8 & 16 bit screendepth. I.e. the 320x240 resolution is *not* available when X is started with 16bit depth (the default).
To test these entries, restart X after you modified XF86Config and press ctrl-alt-plus and ctrl-alt-minus to cycle through the resolutions. -- contributed by Andreas Umbach
How do I get all the dependencies for building SDL on Fedora?
You can install these packages for building SDL 2.0 on Fedora:
sudo yum install rpm-build alsa-lib-devel libX11-devel libXScrnSaver-devel libXau-devel libXcursor-devel libXext-devel libXfixes-devel libXi-devel libXinerama-devel libXrandr-devel libXrender-devel libXxf86vm-devel mesa-libGL-devel pulseaudio-libs-devel
How do I get all the dependencies for building SDL on Ubuntu?
Run the following command: sudo apt-get build-dep libsdl1.2
Or you can get all the dependencies individually:
sudo apt-get install build-essential mercurial make autoconf automake libtool libasound2-dev libpulse-dev libaudio-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev libxss-dev libgl1-mesa-dev libesd0-dev