Building Quake 3 in Raspbian


21 posts
by CargoCult » Thu May 24, 2012 4:25 pm
I'm about to go to work in a minute, so please enjoy some terribly condensed instructions on how to build a superpowered Quake 3 in Raspbian, using Hexxeh's SD card image as a base. I've probably missed something important, but this should be a helpful start.

  1. Make sure you're up-to-date with everything (aptitude update; aptitude upgrade)
  2. Download the Quake 3 source code .tar.gz from here.
  3. As root, aptitude install gcc build-essential
  4. Also as root, aptitude install libsdl1.2debian libsdl-image1.2 libsdl-image1.2-dev libsdl-mixer1.2 libsdl-mixer1.2-dev libsdl-net1.2 libsdl-net1.2-dev (this possibly includes unnecessary stuff and the occasional typo, but it worked...)
  5. Decompress your source .tar.gz and replace build.sh with the following:
    Code: Select all
    #!/bin/bash
    # this script builds q3 with SDL
    # invoke with ./build.sh
    # or ./build.sh clean to clean before build

    # directory containing the ARM shared libraries (rootfs, lib/ of SD card)
    # specifically libEGL.so and libGLESv2.so
    ARM_LIBS=/opt/vc/lib
    SDL_LIB=lib

    # directory containing baseq3/ containing .pk3 files - baseq3 on CD
    BASEQ3_DIR="/home/${USER}/"

    # directory to find khronos linux make files (with include/ containing
    # headers! Make needs them.)
    INCLUDE_DIR="/opt/vc/include"

    # prefix of arm cross compiler installed
    # CROSS_COMPILE=bcm2708-

    CROSS_COMPILE=

    # clean
    if [ $# -ge 1 ] && [ $1 = clean ]; then
       echo "clean build"
       rm -rf build/*
    fi

    # sdl not disabled
    make -j4 -f Makefile COPYDIR="$BASEQ3_DIR" ARCH=arm \
            CC=""$CROSS_COMPILE"gcc" USE_SVN=0 USE_CURL=0 USE_OPENAL=0 \
            CFLAGS="-DVCMODS_MISC -DVCMODS_OPENGLES -DVCMODS_DEPTH -DVCMODS_REPLACETRIG -I$INCLUDE_DIR" \
            LDFLAGS="-L"$ARM_LIBS" -L$SDL_LIB -lSDL -lvchostif -lvmcs_rpc_client -lvcfiled_check -lbcm_host -lkhrn_static -lvchiq_arm -lopenmaxil -lEGL -lGLESv2 -lvcos -lrt -lbcm_host -mfloat-abi=hard -mfpu=vfp"

    # copy the required pak3 files over
    # cp "$BASEQ3_DIR"/baseq3/*.pk3 "build/release-linux-arm/baseq3/"
  6. Do a ./build.sh
  7. Wait.
  8. Wait a bit more. This is assuming I haven't made any mistakes in the guide.
  9. Find copies of the following somewhere (other guides will show you) and place in build/release-linux-arm/baseq3: pak0.pk3 pak1.pk3 pak2.pk3 pak3.pk3 pak4.pk3 pak5.pk3 pak6.pk3 pak7.pk3 pak8.pk3
  10. As root, run ioquake3.arm. Shoot things. (It should work as a non-root user when I figure out the necessary DirectFB incantations.)

Highly non-scientific testing (i.e. having played a normal-Debian build a few days ago) suggests framerate is quite dramatically improved. Go Raspbian!
Posts: 25
Joined: Wed Nov 02, 2011 7:06 am
by mpthompson » Thu May 24, 2012 9:35 pm
Terrific instructions. I added it to the Wiki at the following link so the build instructions can be refined if errors are found.

http://www.raspbian.org/RaspbianQuake3
User avatar
Forum Moderator
Forum Moderator
Posts: 620
Joined: Fri Feb 03, 2012 7:18 pm
Location: San Carlos, CA
by SquallStrife » Thu May 24, 2012 9:42 pm
Running as non-root is simple.

As root, type: usermod -a -G video [username]

Done. Log out, log in with the user you added, should work.

This will work for anything that uses SDL, like DOSBox or ScummVM. (In fact, it should work for anything that uses directfb)

Also, to run a benchmark use the following commands in Quake:

\timedemo 1
\demo four

When it's done, bring down the console with the tilde key, and it will show you some stats. Here's one I prepared earlier: viewtopic.php?p=81365#p81365 :ugeek:
Posts: 10
Joined: Mon May 14, 2012 10:18 am
by SquallStrife » Fri May 25, 2012 4:25 am
Another good build guide here: viewtopic.php?f=63&t=6511&p=83593#p83593

This one includes some configs that can amp up the framerate quite a bit! :)
Posts: 10
Joined: Mon May 14, 2012 10:18 am
by simonlc » Fri May 25, 2012 4:28 am
Hmm didn't see this before I made mine here.

Either way, I thought I'd share the configs I made:
cd ~/.q3a/baseq3 && wget http://simon.lc/files/rpiquake3cfg.zip && unzip rpiquake3cfg.zip
User avatar
Posts: 31
Joined: Wed May 16, 2012 4:11 am
Location: Calgary, AB
by Davespice » Fri May 25, 2012 4:58 pm
Cool I'm going to give this a go, maybe sound will work! =)
User avatar
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 1445
Joined: Fri Oct 14, 2011 8:06 pm
Location: London, United Kingdom
by bbb » Sat Jun 02, 2012 12:09 pm
SquallStrife wrote:Running as non-root is simple.

As root, type: usermod -a -G video [username]
....


If running directly from the console (non-X11) there is a similair work-around needed for accessing the mouse, I'ved posted instructions in another thread: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=63&t=6511&p=90163#p90163
Posts: 51
Joined: Sat Jun 02, 2012 9:52 am
by MarrsAttax » Mon Jun 04, 2012 11:47 am
I followed the instructions then rebooted. Now my keyboard and mouse don't work in XFCE

Any ideas what could have gone wrong? I don't know where to start looking.
Posts: 24
Joined: Fri Jun 01, 2012 2:39 pm
by MarrsAttax » Mon Jun 04, 2012 8:34 pm
Found this in my Xorg.0.log file

Code: Select all
[   187.936] (II) config/udev: Adding input device PIXART USB OPTICAL MOUSE (/dev/input/mouse0)
[   187.936] (II) No input driver specified, ignoring this device.


Does anyone know where would I specify this driver? Why would this have changed?

Thanks
Posts: 24
Joined: Fri Jun 01, 2012 2:39 pm
by mpthompson » Mon Jun 04, 2012 9:03 pm
MarrsAttax wrote:Does anyone know where would I specify this driver? Why would this have changed?


A week or so ago I ran into similar issues with Hexxeh's minimal image and was getting similar messages in the logs with my Microsoft optical mouse and keyboard. I believe a possible fix is to install the two following packages:

apt-get install xserver-xorg-input-kbd
apt-get install xserver-xorg-input-mouse

These shouldn't be needed, but it seems X windows sometimes gets into a state where it cannot autoconfigure the mouse and keyboard. Manually installing the keyboard and mouse packages seems to fix the issue.

Unfortunately, I don't know enough about X windows to understand or explain why this problem occurs.
User avatar
Forum Moderator
Forum Moderator
Posts: 620
Joined: Fri Feb 03, 2012 7:18 pm
Location: San Carlos, CA
by MarrsAttax » Tue Jun 05, 2012 8:19 am
Hi thanks for your help. Re-installing the mouse and keyboard driver didn't work in my instance but gave me the idea to try updating everything else. After I updated the firmware with

Code: Select all
rpi-update


everything magically started working!
Posts: 24
Joined: Fri Jun 01, 2012 2:39 pm
by tomgus1 » Tue Jun 19, 2012 3:46 pm
Hi, I've managed to build on Pisces R2 and I'm trying to run the game but I'm only getting a white screen. does anyone have any ideas?
Posts: 3
Joined: Thu May 31, 2012 10:03 pm
by tornadof3 » Sun Aug 05, 2012 10:02 pm
Hi

After following http://www.raspbian.org/RaspbianQuake3 I seem to be able to get quake to run but I am using ssh with the -Y switch. When I run the program, I can hear a bit of sound but I just get a window that is about 3 cm by 1 cm on my screen that is black and nothing else. If I run the game from a VNC session, something similar happens. Any ideas?
Posts: 7
Joined: Sun Aug 05, 2012 11:47 am
by AlArenal » Wed Aug 08, 2012 8:12 am
I installed Q3 from the repo and have the pk3 files at hand but no matter where I put them q3 complains as if it could not find them.

I remember this has been a lot easier in the past but can't get my hea around it right now.
Posts: 141
Joined: Sun Feb 26, 2012 6:58 pm
Location: Germany
by tornadof3 » Wed Aug 08, 2012 8:48 am
So, if I connect HDMI and keyboard and run quake from the RPi terminal, then Quake works perfectly well, which is great. When done over SSH it appears not to display properly..

Re location of the data files, Quake compiled into a ../build directory, so the path to my baseQ3 files is: /home/pi/quake3/build/release-linux-arm/baseq3
although I did edit the BASEQ3_DIR seetting in the build.sh file so it read "/home${USER}/quake3" prior to compiling, maybe that will make a difference for you?
Posts: 7
Joined: Sun Aug 05, 2012 11:47 am
by ErikP » Sun Aug 19, 2012 6:25 pm
I've built quake3 on my pi following the instructions from http://www.raspbian.org/RaspbianQuake3.

Compiling worked fine and I can start the game, go through the game startup screens and select a level.
But once the level starts and I run around, it crashes after a few seconds, and my pi reboots.

Does anyone have the same problem?
Any ideas what I could do to troubleshoot this?

I'm using the raspian (hardfp) image and have updated all libs (19. August 2012)

Thanks,

Erik
User avatar
Posts: 1
Joined: Sun Aug 19, 2012 6:18 pm
Location: Vienna, Austria
by amyren » Tue Sep 11, 2012 6:12 pm
ErikP wrote:I've built quake3 on my pi following the instructions from http://www.raspbian.org/RaspbianQuake3.

Compiling worked fine and I can start the game, go through the game startup screens and select a level.
But once the level starts and I run around, it crashes after a few seconds, and my pi reboots.

Does anyone have the same problem?
Any ideas what I could do to troubleshoot this?

I'm using the raspian (hardfp) image and have updated all libs (19. August 2012)

Thanks,

Erik


If you have overclocked your pi to the max, you might need to adjust the settings down.
Also check your memorysplit settings. I've read many recommended 192/64 for quake. But it should run ok with 128/128 as well. (I use that)
Posts: 91
Joined: Tue Jun 12, 2012 10:49 am
by amyren » Tue Sep 11, 2012 6:17 pm
AlArenal wrote:I installed Q3 from the repo and have the pk3 files at hand but no matter where I put them q3 complains as if it could not find them.

I remember this has been a lot easier in the past but can't get my hea around it right now.


I had the same issue when trying to use the version from the repo. But eventually I had to make a build myself.
You could try my build if you want, I've uploaded it here:
https://skydrive.live.com/?cid=9D3D4F10 ... 25C9DC!121
Download it to /home/pi and extract with full path. There is even a small scriptfile q3.sh to launch it that will be inn your /home/pi directory if youre to lazy to write the full path :)
This is just the build without the pak files, you need to put them into the baseq3 directory yourself.
Posts: 91
Joined: Tue Jun 12, 2012 10:49 am
by ebito » Fri Sep 21, 2012 5:05 pm
hi,
if I try to compile quake3 in compliance with these instructions I get following error:

make[2]: Entering directory `/quake3'
LD build/release-linux-arm/ioq3ded.arm
LD build/release-linux-arm/ioquake3.arm
/usr/bin/ld:lib/libSDL.so: file format not recognized; treating as linker script
/usr/bin/ld:lib/libSDL.so:1: syntax error
collect2: ld returned 1 exit status
make[2]: *** [build/release-linux-arm/ioq3ded.arm] Fehler 1
make[2]: *** Warte auf noch nicht beendete Prozesse...
/usr/bin/ld:lib/libSDL.so: file format not recognized; treating as linker script
/usr/bin/ld:lib/libSDL.so:1: syntax error
collect2: ld returned 1 exit status
make[2]: *** [build/release-linux-arm/ioquake3.arm] Fehler 1
make[2]: Leaving directory `/quake3'
make[1]: *** [targets] Fehler 2
make[1]: Leaving directory `/quake3'
make: *** [release] Fehler 2


what´s the problem here?

regards
Posts: 9
Joined: Tue Jul 03, 2012 8:03 pm
by fury » Fri Oct 05, 2012 11:11 pm
ebito wrote:hi,
if I try to compile quake3 in compliance with these instructions I get following error:

make[2]: Entering directory `/quake3'
LD build/release-linux-arm/ioq3ded.arm
LD build/release-linux-arm/ioquake3.arm
/usr/bin/ld:lib/libSDL.so: file format not recognized; treating as linker script
/usr/bin/ld:lib/libSDL.so:1: syntax error
collect2: ld returned 1 exit status
make[2]: *** [build/release-linux-arm/ioq3ded.arm] Fehler 1
make[2]: *** Warte auf noch nicht beendete Prozesse...
/usr/bin/ld:lib/libSDL.so: file format not recognized; treating as linker script
/usr/bin/ld:lib/libSDL.so:1: syntax error
collect2: ld returned 1 exit status
make[2]: *** [build/release-linux-arm/ioquake3.arm] Fehler 1
make[2]: Leaving directory `/quake3'
make[1]: *** [targets] Fehler 2
make[1]: Leaving directory `/quake3'
make: *** [release] Fehler 2


what´s the problem here?

regards

ebito, if you haven't yet figured it out, I think this might solve your problem.

I had a problem with the libSDL symbolic link showing up as a regular text file instead of a symbolic link, probably due to the way I unzipped it on a Windows PC then copied over. That file being just a text file caused this linker error:
Code: Select all
/usr/bin/ld:lib/libSDL.so: file format not recognized; treating as linker script
/usr/bin/ld:lib/libSDL.so:1: syntax error


So I had to do this (from my src/quake3 directory):
Code: Select all
cd lib
rm libSDL.so
ln -s libSDL-1.2.so.0.11.3 libSDL.so
cd ..
./build.sh


But that still had problems, so I did a ./build.sh clean and then it worked. I guess it had a leftover from the failed compile that made things a little wonky.
Posts: 9
Joined: Thu Sep 20, 2012 4:37 pm
by mecwerks » Sat Mar 08, 2014 6:59 pm
Hello, i've recently gotten my Pi all setup, and i was interested in putting the changes necessary in making Quake3 run into my fork of the engine. Does anyone happen to know what commit/revision this is based off of? Thanks in advance.
Posts: 1
Joined: Sat Mar 08, 2014 6:57 pm