Compiling for Raspberry Pi

From The Powder Toy
Revision as of 22:45, 14 May 2013 by Candunc (talk | contribs) (Spelling Errors fixed, removed workaround section.)
Jump to: navigation, search

Please note, this has been copy / pasted a bit from the Linux compile tutorial and with some help from the IRC (Mainly Jacob1, Triclops) Guide written by Candunc. Feel free to edit and come on the IRC if you have errors.

  • PLEASE NOTE: All of this will be done command line. Either log out or use the terminal if you are in the Raspbian GUI


Overclocking

Before you do anything, if you want these compiles to run a bit faster, you can overclock to 800 MHz. This won't void your warranty, only overvolting does. To do this is fairly simple, just a few commands.

First, log in (If you aren't already) and then type in 'sudo raspi-config'. Type in your password if it asks for it. This will bring you to a menu, press the down arrow a few times until you highlight overclocking. Press enter, read the text and enter again. Then move your cursor down one to modest, which will give you a 800 MHz core and that is it. It will run a few degrees warmer now, but it will improve compile times.

Enter out of it by tabbing to OK, waiting a bit, and navigate back to the main menu. Tab down to finish and enter, and once reboot by selecting Yes.

Done! You have overclocked your Pi to a safe, 800 MHz. If your Pi gets too hot it will auto un-overclock.


Preparing to compile

You will need the following packages:

git-core - GIT control system, lets you connect to the repo

libsdl1.2-dev - SDL Libaries

libbz2-dev - BZip2 Libaries - 64bit systems use lib64bz2-dev

liblua5.1-0-dev - Lua libaries

build-essential - Compiling tools

libfftw3-dev - In latest compiles it's necessary.


To install all of these packages, all you need to do is the following command

sudo apt-get install git-core build-essential libsdl1.2-dev libbz2-dev liblua5.1.0-dev fftw3-dev screen

Next, you need to free up core RAM for the compile. if you have a model B rev 3 or later (ones with 512 MB RAM), you can skip this step.

Type in 'sudo raspi-config' typing in your password if it asks for it. Then navigate down to memory split. If you are using your pi hooked up to a display, try with 32 or 16, otherwise put in 8 to free up as much RAM for the compile as possible. Tab down to ok, and save everything and quit. Select yes if it asks you to reboot.

If you skipped the above step, type in sudo reboot, putting your password in if it asks

Now that you've reboot, you should download the latest source.

Type in 'wget https://github.com/FacialTurd/The-Powder-Toy/archive/master.zip'

This will download the latest source. You can unzip it by typing 'unzip master.zip'

This will create a folder called The-Powder-Toy-master. Rename it to something simple with this command: 'mv The-Powder-Toy-master/ TPT/'

Done! Readied the compile environment for compiling.

Compiling the source

Now that you've got it down, it will need to compile. This will take a while to compile, so if you are ssh'ing to the raspberry pi you may want to type screen before the command.

To compile, you'll need to type in these following commands:


cd TPT

scons --rpi --release

OR if you plan to leave the session

screen scons --rpi --release

You can close the window and come back to your compile by typing 'screen -r'

This will take a while, and it will have a lot of text spew out of it.

If it doesn't compile and says 'You must specify a platform to target', the source hasn't been merged. You can work around it though. Skip to 'Workaround' if this happens, its below this section


If it does compile right, you will have something called 'powder-legacy' in your build folder. You can view this by typing in 'ls build/' if it isn't there, something went wrong. To start it, move it to another computer or you can try it (with very poor fps) by going into the gui, cd'ing to the folder, and typing ./powder-legacy

You are done and have compiled! If you didn't, continue down.


Credits

If you feel like there is something missing, or needed to be edited, please do and place your name (if you want) in the credits.

Guide written by Candunc

Special Thanks to Jacob1 and Triclops200 on IRC for helping me out, as well as the guys on Stack Exchange and the Raspberry Pi Forums.