User avatar
Posts: 19
Joined: Sat Mar 02, 2013 11:24 pm
Location: Betelgeuse

Cross compiling SDL (succesful)

Sat Apr 06, 2013 12:30 pm

Here is short tutorial for someone inexperienced like me. I'm not sure whether it is optimal, but it worked. This tutorial is for Linux host PC.

1. Prepare your Linux host. I created directory raspidev in my HOME
mkdir raspidev
cd raspidev
mkdir SDL_cross

2. Get official cross tools for Raspberry Pi.
git clone git://

3. Download and extract SDL 1.2
gzip -dc SDL-1.2.15.tar.gz | tar xf -

4. Prepare your environment. Note: perhaps not all the steps below are absolutely necessary, but it works at least.
export ARCH=arm
export CROSS_COMPILE=arm-bcm2708hardfp-linux-gnueabi-
export CC=~/raspidev/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-gcc
export NM=~/raspidev/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-nm
export LD=~/raspidev/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-ld
export CXX=~/raspidev/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-g++
export RANLIB=~/raspidev/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-ranlib
export AR=~/raspidev/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-ar

5. Compilation
cd SDL-1.2.15
./configure --disable-pulseaudio --target=arm-linux --host=arm-linux

6. Now you can edit Makefile with your favourite editor, change:
prefix = ~/raspidev/SDL_cross
Save file

7. Final step
make install

Now your ~/raspidev/SDL_cross contains SDL library ready to use.
Have fun
So long, and thanks for all the fish!

Posts: 16
Joined: Thu Mar 28, 2013 7:47 pm

Re: Cross compiling SDL (succesful)

Thu Apr 11, 2013 5:28 pm

Thanks for posting!

I've played with SDL a little on the PC using the Linux before and it is very useful.
Very simple and direct.

I will have to look into it on the Pi now.

Appreciate all of the details!

Posts: 1
Joined: Fri May 31, 2013 10:17 am

Re: Cross compiling SDL (succesful)

Fri May 31, 2013 10:23 am

Hello when i run the make command i get this errors message :

./src/audio/dma/SDL_dmaaudio.c : IN fuction 'DMA_Waitaudio':
./src/audio/dma/SDL_dmaaudio.c : error : impossible constraint in 'asm'
make : *** [build/SDL_dmaaudio.lo] error 1

help me and thank you

Return to “Graphics programming”