Difference between revisions of "Compiling for Raspberry Pi"

From The Powder Toy
Jump to: navigation, search
(Fix formatting)
(remove unnecessary / broken things)
Line 47: Line 47:
 
<code>sudo apt-get install scons git-core build-essential libsdl1.2-dev libbz2-dev liblua5.1.0-dev fftw3-dev screen</code>
 
<code>sudo apt-get install scons git-core build-essential libsdl1.2-dev libbz2-dev liblua5.1.0-dev fftw3-dev screen</code>
  
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.  
+
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 <code>sudo raspi-config</code> 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.
 
Type in <code>sudo raspi-config</code> 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.
Line 59: Line 59:
 
This will download the latest source. You can unzip it by typing 'unzip 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. Rename it to something simple with this command: <code>mv The-Powder-Toy/ TPT/</code>
+
This will create a folder called The-Powder-Toy. If you want, rename it to something simple with this command: <code>mv The-Powder-Toy/ TPT/</code>
  
 
Done! Readied the compile environment for compiling.
 
Done! Readied the compile environment for compiling.
Line 72: Line 72:
 
<code>cd TPT</code>
 
<code>cd TPT</code>
  
<code>scons --rpi --release</code>
+
<code>scons</code>
  
 
OR if you plan to leave the session
 
OR if you plan to leave the session
  
<code>screen scons --rpi --release</code>
+
<code>screen scons</code>
  
You can also use <code>--sse2</code> or <code>--sse3</code> for sse optimizations if you have a recent (not ancient) computer, or <code>-j4</code> to compile with 4 cores (or how ever many you have). For other arguments, see the [[Scons_command_line_flags|list of all Sconscript flags you can use]]
+
You can also use <code>-j4</code> to compile with 4 cores (or how ever many you have). For other arguments, see the [[Scons_command_line_flags|list of all Sconscript flags you can use]]
  
 
You can close the window and come back to your compile by typing <code>screen -r</code>
 
You can close the window and come back to your compile by typing <code>screen -r</code>
Line 84: Line 84:
 
This will take a while, and it will have a lot of text spew out of it.  
 
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' 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 <code>./powder</code>.
  
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 <code>./powder-legacy</code>.
+
You are done and have compiled! If you didn't, ask for help on the forums or IRC.
 
 
You are done and have compiled! If you didn't, continue down.
 
  
  

Revision as of 02:56, 31 August 2014

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 (Optional)

Overclocking is not required however it can improve build times significantly as building with stock settings and limited RAM can take over 10 minutes. By overclocking your Raspberry PI you are not voiding your warranty but overvolting will (Overvolting increases the amount of power going to the CPU). Many extensive overclocking tutorials are out there however below is a very basic guide.

1. Log in to your distribution

2. Open terminal if not already open

3. Type in sudo raspi-config and enter your root password. This 'COULD' be different to your user password.

4. On the menu select 'overclocking'

5. Read the text and follow instructions until you come to a selection where you are able to select 'Modest'. This overclock will set the processor to 800mhz.

6. Tab to 'OK' and after a short wait you will be able to exit back the main menu and force the Raspberry PI to reboot.

If for any reason the Raspberry PI no longer works, you can reset the overclock by putting the SD card into a computer and changing the configuration file back to what it is meant to be. It is not possible to damage your Raspberry PI with a frequency overclock alone.

It is unlikely that your Raspberry PI will overheat with this new overclock, if it does the PI will automatically set itself to the normal overclock setting. You can use heat sinks or a fan to apply additional cooling if needed.

Preparing to compile

You will need the following packages:

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

scons - Build System

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 scons 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 rebooted, you should download the latest source.

Type in git clone git://github.com/simtr/The-Powder-Toy.git

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

This will create a folder called The-Powder-Toy. If you want, rename it to something simple with this command: mv The-Powder-Toy/ 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

OR if you plan to leave the session

screen scons

You can also use -j4 to compile with 4 cores (or how ever many you have). For other arguments, see the list of all Sconscript flags you can use

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 does compile right, you will have something called 'powder' 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.

You are done and have compiled! If you didn't, ask for help on the forums or IRC.


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.