Lazarus on Linux

Introduction

We now have a guide to show you how to install Lazarus on the Linux operating system of a Raspberry Pi and we hope that many students will use it to develop Pascal programs. In 2012, before obtaining a Pi, we installed Lazarus 0.9.28.2 Beta on our Debian operating system hosted by Oracle VM VirtualBox on Windows Vista (using the command apt-get install lazarus at the Root Terminal). We describe some initial experiments below.

A new simple forms application compiled and ran as expected on pressing F9.

A "Hello World" console application compiled but the console window did not show and we had to stop it manually (CTRL+F2). We could execute the program from the command line by typing its full path.

Alternatively, following advice in the Free Pascal Wiki, we could select Lazarus menu item Run > Run Parameters and check the Launching Application Box. We also needed to change the file data in the corresponding edit box from

/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e (LazarusDir)/tools/runwait.sh $(TargetCmdLine)

to

/usr/bin/xterm -T 'Lazarus Run Output' -e (LazarusDir)/tools/runwait.sh $(TargetCmdLine)

Use Ctrl + right click to obtain a menu for changing the font of the console window. Alternatively, you can insert in the above Lazarus edit box the xterm font parameter -fn '*-fixed-*-*-*-18-*'

We tested the programs from ChristmasProg to Crossword in the table and all those that did not use the Windows unit ran without problems. In order to execute another program you can use fpSystem in the Unix unit (instead of ShellExecute in the Windows unit) as follows.

program execprog;
uses
  Unix;
begin
  fpSystem('iceweasel http://www.pp4s.co.uk');
  writeln('You have closed the browser. This program continues.');
  readln;
end.  
We obtained the command prompt by selecting menu item Applications > Accessories > Root Terminal then typed at the prompt the full pathname /home/pps/launch/execprog.

The program caused a warning to be output to the console window: (firefox-bin:3936): GnomeUI-WARNING **: While connecting to session manager: None of the authentication protocols specified are supported. It then worked as expected.

You can use fpSystem to execute other commands. (Try them at the Terminal first). Using commands in Pascal programs should help you to learn them. A tutorial provides an excellent introduction.

Programming - a skill for life!

Getting Started, Links and other resources