Log in

View Full Version : Compiling on Rasperry Pi



Ñuño Martínez
19-02-2013, 04:24 PM
(Comes from this thread (http://www.pascalgamedevelopment.com/showthread.php?13022-Welcome-to-PGD!-Make-your-first-post-here&p=88555&viewfull=1#post88555).)


Thanks for replying - sorry about not posting in the right forum, will next time.
There is allegro for raspberry pi - it just needed an apt-get allegro. Your -FU option didn't work, but you were right about the write permissions issue - I just needed to compile with sudo fpc test.pas
You shouldn't never compile as root (or sudoer).

Option -FU is to tell the compiler where to save the output of compiling units. Anyway, the error you posted:


albase.pas(209) Error: Can't create assembler file: /usr/lib/fpc/2.6.0/units/arm-linux/allegro.pas/albase.pas/albase.s
Your compiler is trying to create an assembler file instead of an object file. May be your should use option -ap:


-a The compiler doesn't delete the generated assembler file
-al List sourcecode lines in assembler file
-an List node info in assembler file
-ap Use pipes instead of creating temporary assembler files
-ar List register allocation/release info in assembler file
-at List temp allocation/release info in assembler file

Anyway, as a temporary assembler file it should create it at /tmp. May be your FPC configuration isn't correct.

3Shrike3
19-02-2013, 07:22 PM
Thanks - you are right about -ap
Out of curiosity, what is wrong with compiling as root?

WILL
20-02-2013, 04:24 AM
Can someone post some good sources of information about the Raspberry Pi hardware? I'd like to know a little more about it as this isn't the first time I've read about this being done in the Object Pascal world. It has also been done using Oxygene for Java.

WILL
20-02-2013, 04:45 AM
Ok here goes the answers to my own question: http://www.raspberrypi.org/faqs



http://www.youtube.com/watch?v=rpWUBwGy7jY


http://www.youtube.com/watch?v=DWI1CcJM0y8

Ñuño Martínez
20-02-2013, 12:27 PM
Out of curiosity, what is wrong with compiling as root?
Root is the super-user. It has access to everything in your computer, including core configuration and system. Programs started by any user inherits their security configuration. That means they have access to everything in your computer, including core configuration and system. "Normal" users don't have that level of access, or they have limited access to it (for example, it can be configured to allow it to administrate some part of the OS). So programs started by "normal" users haven't access to everything in your computer.

Now imagine that FPC has a bug, or it is infected by virus, and if you run it then it deletes/modify a file from your hard-disk, randomly. If the program has Root access configuration it is able to remove/modify core configuration files. Now you see the problem, don't you? That's also why POXIX operating systems (i.e. UNIX, Linux, MacOS, etc) have fewer viruses than Windows and DOS, because most user programs don't have access to core system (i.e. they can't install themselves as system programs).

On topic again (about compilation of Allegro.pas), once you finish your testing, can you tell us your experience? I'm curious to know if it works in anything different than PC-Windows and PC-Linux. Also tell me about what problems you had and if you needed to make changes to Allegro.pas, to add it to the next release of Allegro.pas.

As Will said, it would be great if we can port our games to such platform. :)

Thank you.

3Shrike3
20-02-2013, 07:29 PM
Ok,
For everything I have done so far, and for compiling your examples, fpc source.pas -ap has worked fine.
I installed fpc with sudo apt-get install fpc. It took about fifteen minutes I think.
(I then tried to install Lazarus the same way, but I accidentally cut the power during the install (it had already taken about 30 minutes). I tried tons of removes and reinstalls, and once I got it to start, but it came up with loads of missing package files. Since, I haven't even been able to open it and have more or less given up.)
Back to allegro.pas ...
I installed allegro with a sudo apt-get install allegro . I then downloaded the allegro.pas file and extracted it to my folder. For some reason the fix.sh script did not work, so I had to manually add target.os, which I wrote TARGET=linux in (I might have got the caps wrong ... I will check later.)
EDIT: yep, i got the caps wrong, I actually had target=LINUX in the target.os file.
Anyway, after adding the target.os file, the make command ran fine.
to be continued... gtg

3Shrike3
20-02-2013, 10:28 PM
So, part two:
The demo then ran fine, a bit jumpy, but that is to be expected from a £20 computer with little processing power! The exscn3d program, the one with all the spinning cubes would run at around 20 fps - is that due to the low processing power on the RPi, or is it just that allegro is not very fast at 3d? All your examples compiled and ran fine then, except:
exrotscl wouldn't open and gave the error message 'Could not load inkblot.tga'
exxfade gave error message 'Error loading image file 'allegro.pcx''
However, exscn3d, which uses allegro.pcx, ran fine.
I then copied the contents of the lib directory into a new directory called allegro.pas in /usr/lib/fpc/2.6.0/units/arm-linux , which is where fpc is installed if you use apt-get. From then everything worked and I just needed to add -ap to compile.

Ñuño Martínez
21-02-2013, 10:15 AM
I installed allegro with a sudo apt-get install allegro . I then downloaded the allegro.pas file and extracted it to my folder. For some reason the fix.sh script did not work, so I had to manually add target.os, May be your Linux doesn't has /bin/sh .


The demo then ran fine, a bit jumpy, but that is to be expected from a £20 computer with little processing power! The demo game is very simple, but I didn't optimised it a lot. I'm sure it can run faster, but it needs a profile (AFAIK FPC and GNU profiler don't work together) and better tilemap+sprite rendering.


The exscn3d program, the one with all the spinning cubes would run at around 20 fps - is that due to the low processing power on the RPi, or is it just that allegro is not very fast at 3d? As documentation (http://allegro-pas.sourceforge.net/docs/al3d.html) says:

It is not, and never will be, a fully fledged 3d library (the goal is to supply generic support routines, not shrink-wrapped graphics code :-) but these functions may be useful for developing your own 3d code.
Anyway, it has one of the fastest software based 3D renderer I've seen. It will never beat OpenGL, but beats Mesa in some cases.


All your examples compiled and ran fine then, except:
exrotscl wouldn't open and gave the error message 'Could not load inkblot.tga'
exxfade gave error message 'Error loading image file 'allegro.pcx''
However, exscn3d, which uses allegro.pcx, ran fine.
I don't understand why exscn3d runs but exxfade fails. I'll see if I can find an explanation.

Anyway, most of examples runs. That's really cool. I should tell everybody.