Difference between revisions of "Compiling for Raspberry Pi"

From The Powder Toy
Jump to: navigation, search
(Overclocking: Simplified)
(Add outdated notice)
 
(7 intermediate revisions by 6 users not shown)
Line 1: Line 1:
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.
+
'''ATTENTION: This guide is outdated as of 2021. Please use this guide for building any recent version of the game: [[Building TPT with Meson]]'''
  
* PLEASE NOTE: All of this will be done command line. Either log out or use the terminal if you are in the Raspbian GUI
+
{{Languages|Compiling for Raspberry Pi}}
 +
Hi!
  
 +
Compiling TPT on the Raspberry Pi is exactly the same process as compiling it on Linux.
  
==== Overclocking ====
+
So, implying you use Raspbian, which most people do, just follow [[Compiling TPT++ on debian/ubuntu]] and run scons as you would normally. The default flags might enable SSE, so disable that with <code>--no-sse</code>. It's going to take forever to build, so if you have a Pi 2 then you can use <code>-j4</code> to utilize the quad-core processor fully.  
 
 
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
 
 
 
''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.
 
  
 
[[Category:Development]]
 
[[Category:Development]]
 
[[Category:Compiling]]
 
[[Category:Compiling]]

Latest revision as of 08:59, 3 April 2021

ATTENTION: This guide is outdated as of 2021. Please use this guide for building any recent version of the game: Building TPT with Meson

Language: English  • 中文

Hi!

Compiling TPT on the Raspberry Pi is exactly the same process as compiling it on Linux.

So, implying you use Raspbian, which most people do, just follow Compiling TPT++ on debian/ubuntu and run scons as you would normally. The default flags might enable SSE, so disable that with --no-sse. It's going to take forever to build, so if you have a Pi 2 then you can use -j4 to utilize the quad-core processor fully.