Difference between revisions of "Compiling for Raspberry Pi"

From The Powder Toy
Jump to: navigation, search
(Prepairing to compile: Added rev 1/2 rpi workaround)
m (Reverted edits by lamyipfu (talk) to last revision by TOC_Official)
(12 intermediate revisions by 9 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.
+
{{Languages|Compiling for Raspberry Pi}}
 +
Hi!
  
* PLEASE NOTE: All of this will be done command line. Either log out or use the terminal if you are in the Raspbain GUI
+
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 <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 ====
+
[[Category:Development]]
 
+
[[Category:Compiling]]
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 overclock down.
 
 
 
 
 
==== Prepairing 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 kore 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 enviroment 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.
 
 
 
 
 
==== Workaround ====
 
 
 
cd to your TPT folder again by typing 'cd TPT/'
 
 
 
Type 'rm SConscript', and after that type 'wget https://dl.dropbox.com/u/21878081/SConscript'.
 
 
 
This will put a workaround made by me into your compile. Try compiling again with the new file, and if it fails, there is always the 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.
 
 
 
Wrote by Candunc
 
 
 
Special Thanks to Jacob1 and Tryclops on the IRC for helping me out, as well as the guys on Stack Exchange and the Raspberry Pi Forums.
 

Revision as of 04:41, 17 May 2019

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.