[Lazarus] Cross-compiling for Raspberry Pi2

Martin Schreiber mse00000 at gmail.com
Fri Sep 18 07:00:06 CEST 2015

On Friday 18 September 2015 01:28:16 Bo Berglund wrote:
> I have a need to port a Delphi console program written for Windows to
> be used on Raspberry Pi2.
> Apparently it is possible to use Freepascal to get programs running on
> the Pi2 platform, but can it be done in Windows so I don't have to
> install the complete IDE on a Pi and set it up with a monitor,
> keyboard and mouse just for running the compile?
On Linux X86 you could use MSEide and the FPC cross compiling environment from 

I assume it is possible to make something similar for Lazarus and Windows, I 
don't know if it already exists.

For integrated development with FPC 3.0.1 MSEide+MSEgui git master version is 


Crosscompiling and remote debugging i386-linux -> arm-linux
For Raspberry Pi:
- Establish a ssh login without password (public key authentication).

- On the i386-linux host install the scp program
- download and extract 
  to <your crossfpc directory>.

- Start MSEide, in 'Settings'-'Configure MSEide'-'Global Macros' add:

Name          Value

CROSSMSEDIR   <MSEide+MSEgui directory>
CROSSFPCDIR   <your crossfpc directory>
HOSTIP        <the IP of the host>
REMOTEIP      <the IP of the remote target>
REMOTEPORT    <the remote port, ex: 2345>

- 'Project'-'New'-'From Template', select "crossarmdefault.prj" or
- Create the new project.
- 'Project'-'Options'-'Macros', set the TARGETPROJECTDIR value to the project
  path in remote target, ex: "/home/pi/proj/testcase".
- Check the TARGETENV macro.
- If your application needs additional libraries copy them from Raspberry Pi
  /lib/arm-linux-gnueabihf or /usr/lib/arm-linux-gnueabihf to
  <your crossfpc directory>/eabihf/lib

Press F9 and hope the best. ;-)
MSEide+MSEgui also runs amazingly fast natively on the Raspberry Pi, the 
limiting factor is FPC compiling speed and memory consumption especially for 
smart linking.


More information about the Lazarus mailing list