Page 1 of 1

How to install Lazarus Pascal on Raspberry Pi 2 (Raspbian)

How to install Lazarus Pascal on Raspberry Pi 2 (Raspbian)
   279

For those of you who have visited Tweaking4All more often, you might have noticed that I really like Lazarus Pascal. I use it to develop little freeware applications for multiple platforms (if possible), like for Windows, MacOS X and Linux.

So why not on a Raspberry Pi (Raspbian)? Lazarus allows Rapid Application Development in the good old Delphi style which would be ideal for a platform like the Raspberry Pi. Specially since the Raspberry Pi  2 Model B seems to be fast enough as well.

Now me and my brother-in-law (Jean-Pierre) are planning to build an Alarm system based on a Raspberry Pi 2, use a TouchScreen and plenty of sensor. Lazarus Pascal could be ideal for this purpose.

To my disappointment, it took me a lot of time to get Lazarus to run on my new Raspberry Pi 2 Model B … so that’s why I wrote this article, which is basically a compilation of a lot of steps that I found scattered all over the Internet.




Why Lazarus Pascal?

Lazarus Pascal a free Delphi look-a-like and compatible Pascal development environment based on FPC (Free Pascal Compiler).

I can highly recommend it, specially when you’ve been a Delphi fan or when you’d like to do cross platform application development with Pascal. I’m a Pascal fan, and love the way it’s done in Lazarus and Delphi. It’s powerful and allows for very quick development of applications.

You would think that Lazarus/FPC would be ideal for developing apps for a Raspberry Pi,… right?

What seems to be the problem?

Well, for older Raspberry Pi models (different CPU), one could use “apt-get” (even though that results in an antiquated version) to get all we need. As the Lazarus Pascal Wiki describes:


1
2
3
4
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install fpc
sudo apt-get install lazarus

On a Raspberry Pi 2 Model B however, this does NOT work – you will get all kinds of error messages.

This is could be (but I’m not an expert) caused by the differences in CPU – see also this comparison chart. The previous Raspberry Pi models (A, B, B+) use a Broadcom BCM2835 chip which uses a ARMv6 single core CPU. The newer Raspberry Pi 2 model however uses a Broadcom BCM2836 chip with a ARMv7 quad core CPU.

Again: I’m not an expert … I just know the regular Raspberry Pi method fails …

I’ve learned a lot from this article “Raspberry Pi 2, FreePascal, Lazarus and Delphi” and have modified steps from his guide based on my own experiences and my own purposes. So much of the credits go to Simon Stuart for the work he has done! Without his article I would have spend even more than the 2 full days I’ve spent so far getting FPC and Lazarus to compile for the first time. But please note that my steps are not identical to Simon’s guide – so do not mix both articles.

I’ve collected more information from several websites, listed at the end of this article.

Lazarus Pascal on Raspberry Pi 2 Model B

  Keep in mind: This article was written ONLY FOR THE RASPBERRY PI 2 Model B.

I’ll explain step for step how I have done things to get to a point where I can develop applications in Lazarus Pascal – follow the steps carefully and it should work OK.

I’ve run through my steps numerous times, and if you follow each step as described, you too should end up with a working FPC and Lazarus on your Raspberry Pi 2.

Do I have a Raspberry Pi 2?

The most confusing thing (for me anyway) is the naming of the Raspberry Pi 2 (a.k.a. Raspberry Pi 2 Model B) – it sounds a lot like the Raspberry Pi Model B and looks a lot like it too, so pay attention …

A few pointers to identify the Raspberry Pi 2:

  • 4 USB slots (most older models have only 2)
  • Ethernet connector
  • No composite video output (yellow RCA seen on older models)
  • The big chip on top should say “BroadCom BMC2836
  • There should be a big memory chip on the backside of the PCB
  • Below the GPIO connector it should say something like “Raspberry Pi 2 Model B

 

You can also use cat /proc/cpuinfo  from the command line.
The output should show 4 blocks (one for each core), each with something like this:


processor   : 0
model name  : ARMv7 Processor rev 5 (v7l)
BogoMIPS    : 38.40
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xc07
CPU revision    : 5

 

Raspberry Pi 2

Raspberry Pi 2

What do we need …?

Obviously we need a Raspberry Pi 2, the one with the quad core ARM based Broadcom chip.

We also need a 16 Gb or larger micro SD card (8 Gb worked for me with Wheezy, but other users have ran into space issues with newer versions – Thx Bosseb!).
Probably good to look for a faster model (at least a Class 10 – see SD-Card.org).

For this process you’ll need a HDMI capable monitor or HDMI capable TV, and at least a USB keyboard.
A USB mouse is in the first steps not needed, but definitely required for using Lazarus by itself, unless you’re planning on using remote-access (VNC).

We will need Internet access for which I highly recommend using a wired Ethernet connection – USB WiFi dongles on the Raspberry Pi are notoriously known to be super slow and drop a lot of packets. I would definitely NOT use WiFi. It will become highly annoying and unreliable very fast!

After collecting those items, we need to downloaded the latest RaspBian image from the Raspberry Pi download page, the described steps might work for other distro’s as well, but I have not tested that. I’ve been working with RaspBian Wheezy.

In the steps to follow we will install a few packages, subversion, FPC and of course the Lazarus Pascal IDE.

  Note: this process will take about 2 hours …!

Preparing the Raspberry Pi to get started with Lazarus Pascal

These are the steps we will execute:

 

Step 1 – Flash RaspBian to your SD-Card

Like I said before, we first need to download the latest RaspBian image (ZIPPED IMG file) from the Raspberry Pi download page.

Next step is to install that image on our SD-card. Read the article “Raspberry Pi – How to get an Operating System on a SD-Card” how to do this – it relatively easy. Note that Rasbian is typically downloaded as a ZIP file and unzipping that file before proceeding might be needed, unless you use v1.6 of ApplePi-Baker (MacOS X only).

To jump directly to the section relevant for you:

 

Step 2 – First Boot Configuration for RaspBian

After flashing the SD card, time to place it into your Raspberry Pi 2 and boot for the first time.
Hookup your monitor or TV, and you’ll need at least an USB keyboard connected for this procedure and finally connect the powersupply (this can be any 2A or better Android charger).

During the initial boot you’ll see some text flying by, never mind that.
After a few seconds you’ll see the initial RaspBian configuration screen.

 Note : Do NOT enable booting into the desktop just yet! It takes away too much memory for compiling FPC/Lazarus.

In this screen use the   Arrow Up and   Arrow Down key to go through the options, and use the ENTER key to select.

Once you’ve done all the settings use the   Arrow Right or   Arrow Left key to go to the “Finish” option.

In the next steps we will:

  1. expand the filesystem,
  2. change the user password,
  3. overclock the Raspberry Pi,
  4. enable SSH and
  5. reboot the Raspberry Pi  ….

 

 Expand Filesystem (required)

This is the basic step we all do: maximize the filesystem so that our entire SD card is being utilized.

Select “1 Expand Filesystem” and press ENTER.

RaspBian - Expand FileSystem

RaspBian – Expand FileSystem

Some text will fly by, and a window will appear confirming that the filesystem has been expanded. Click “OK“.

 Change the user password (optional)

This step is optional.
The default username is “pi” and the default password is “raspberry” (without the quotes).

I changed mine to an even simpeler password, but that’s completely up to you.

Select “2 Change User Password” and press ENTER.

RaspBian - Change User Password

RaspBian – Change User Password

You will be prompted (at the bottom of the screen) to enter the new password twice and after that a confirmation will show that the password has been changed. I’m not even sure if this is possible, but I’d avoid an empty password.

 Overclock your Raspberry Pi (optional)

I’m not a big fan of overclocking, but in this case we can make a relatively safe overclock.
The compiling process we will start will chew a lot of resource, so a few extra MHz could be beneficial.

CAUTION with OVERCLOCKING 

Overclocking your Raspberry Pi might give a nice speed boost, but be very aware that it might reduce the life span of your Raspberry Pi. At higher speeds, your Raspberry Pi will get hotter! Proper cooling would be a good thing to do.

I have had good experiences with settings up to and including “Medium”.
But this does not mean that it will work fine for your Raspberry Pi as well.

Overclock at your own risk!

Select “7 Overclock” and press ENTER.

RaspBian - Overclocking

RaspBian – Overclocking

After a warning message, you can select the amount of overclocking you prefer.
The maximum overclock I would consider “safe” is the “Medium” setting – I’d avoid anything above that, even though your Raspberry Pi might work just fine with higher settings. Overclocking is always at your own risk!

Raspberry Pi - Overclocking Options

Raspberry Pi – Overclocking Options

 Enable SSH access (required)

For the steps following we will need SSH access, since we will do most of the work in an SSH Shell.

Select “8 Advanced Options” and press ENTER.

RaspBian - Advanced Options

RaspBian – Advanced Options

In the next window select “A4 SSH” and press ENTER.

RaspBian - Enable SSH access

RaspBian – Enable SSH access

In the next window, select “Enable” to actually enable SSH.

 Completing RaspBian configuration (required)

Once you’ve done all the settings use the   Arrow Right or   Arrow Left key to go to the “Finish” option and reboot.

Step 3 – Some initial Tweaking

In this step we will:

  1. Disable the boot rainbow,
  2. Increase Swap File Size,
  3. Find the IP address of our Raspberry Pi (for SSH access).

 

These steps can be executed in the command line directly.
However, when you already know the IP Address of your Raspberry Pi and you have already shell access through SSH, then you can most certainly execute them there as well. In that scenario you can of course skip the “Find the IP Address” step …

 Remove SplashScreen Rainbow at boot (optional)

I personally am not a fan of the rainbow that appears during boot, so with a little trick we can remove this.

Raspberry Pi - Disable boot rainbow

Raspberry Pi – Disable boot rainbow

In the command line of your Raspberry pi, we can edit the configuration file for this, which is found on the directory called “/boot/” where we will find a file called “config.txt“. We can use Nano to edit this file:


sudo nano /boot/config.txt

At the end of this file, we will add an extra line to disable the rainbow (for more options see the config.txt documentation):


disable_splash=1

After adding this line, save it and close the text editor. This can be done with CTRL+X, press “y”, and press ENTER.

 Increase the swap file size (required)

Since we need extra memory for the compiling process, we temporary up the swap size of RaspBian.
We can use NANO to edit the swap file size.


sudo nano /etc/dphys-swapfile

There will be only one line in this file, change it so it reads:


CONF_SWAPSIZE=500

Once modified, press CTRL+X to close Nano. It will ask if you want to save it (press “y”) and confirm the filename (press ENTER).

“can’t call the assembler, error -1” 

When recompiling the Lazarus IDE at a later time, you could run into this error. In this case it indicates that we’re running out of memory.

In the rare ocassion that this happens (I was installing BRGAControls), up the swap value even more:

CONF_SWAPSIZE=1000

 

 Determine the IP address of your Raspberry Pi for SSH access (required)

To be able to use SSH, we will need to know the IP Address of the Raspberry Pi – you could try using the [default] device network name “raspberrypi” but it failed in my setup.

  Make sure you’ve connected the Ethernet of your Raspberry Pi before continuing.

SSH needed for this project …  

All the following steps have been done with SSH (until the point where I switch to starting Lazarus in Step 7).

It is crucial that for example X (Desktop) is not be running during these steps to conserve as much memory as possible, as we we need as much as possible desperately during the compilation and installation of FPC and Lazarus Pascal IDE.

To find the IP address, in the command line or Teminal type:


ifconfig

You should see something like this:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
pi@raspberrypi ~ $ ifconfig
eth0      Link encap:Ethernet  HWaddr b8:27:eb:f6:5e:4d  
          inet addr:192.168.2.9  Bcast:192.168.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:545 errors:0 dropped:0 overruns:0 frame:0
          TX packets:98 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:34746 (33.9 KiB)  TX bytes:14520 (14.1 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1104 (1.0 KiB)  TX bytes:1104 (1.0 KiB)

If you look at line 2, you’ll see it starts with “eth0” – this is your ethernet adapter.
In line 3, next to “inet addr:” you will see the IP address of your Raspberry Pi – take note of it (in this example: 192.168.2.9).

Now you can use your favorite SSH application to access your Raspberry Pi from your computer – as of this point HDMI Monitor (or TV) and USB keyboard will no longer be needed.

Read this short article on “How to work with SSH connections (SSH Clients)” – You can right away jump to the section relevant for the OS on your computer with these links:

 

If you’d rather use your browser, then you could also use this method with Google Chrome.

 Reboot you Raspberry Pi

If you made any of these changes: Reboot your Raspberry Pi:


sudo reboot

Step 4 – Getting the latest Free Pascal Compiler

Before we can install Lazarus, we will need Free Pascal Compiler (FPC) to be able to compile it.
But here comes the kicker … to get the latest FPC version we will need FPC to compile the latest FPC version. This is called Bootstrapping (according to the Wiki page).

Don’t worry, I’ll walk you through the process, one step at a time.
Please keep in mind that I’m not an expert either.

Bad Suggestion… that seems to work…  

I’ve installed FPC and Lazarus IDE on several SD-Cards, so I had to go through these steps a few times.

Funny observation is that when I simply copy the suggested commands in the SSH window, followed by pressing ENTER, without even thinking, the process goes very well. The minute I start thinking about what I’m doing, I seem to be bound to fail haha …

Now I can already hear the more experienced users grinch… and they are very right in doing so.

This however works for me time and time again (with these particular steps).

 Install SubVersion (SVN)

First we will get “subversion” (a.k.a SVN) so we can download the latest version from the Free Pascal SVN.
From the shell, via your SSH connection, execute the following (when asked for confirmation, simply press ENTER):


1
2
3
sudo su
apt-get update
apt-get install -y subversion

This will open a Super User shell (su), tell “apt-get” (a package manager) to update, and finally download and install subversion.

 Install FPC 2.6.4

To be able to compile the latest FPC version, we will first need to get an older FPC version, which is relatively easy by getting a pre-compiled ARM version.


1
2
3
4
5
mkdir /usr/local/fpc
cd /usr/local/fpc
wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.4/fpc-2.6.4.arm-linux.tar
tar xvf fpc-2.6.4.arm-linux.tar
cd fpc-2.6.4.arm-linux

Caution: Use the right Install Prefix 

In the next step, we will install FPC, but you have to be aware that the [first] question

Install prefix (/usr or /usr/local) [/usr] :

MUST be answered with /usr/local, otherwise everything will go to hell and fail.

Now execute the install script as follows, and remember to answer the first question correctly – all other questions can be answered by pressing ENTER and therefor taking the default option.


1
./install.sh

Once done, you can type fpc  on the command line for verification, which should give you the help info for FPC, starting with a statement of the FPC version (2.6.4).

 Downloading the latest FPC version sources

The next step is to get the latest FPC sources from SVN. This will take a little bit, so start looking for that cup of coffee …


1
2
3
cd /usr/local/fpc
svn co http://svn.freepascal.org/svn/fpc/trunk source
cd source
 Compile the latest FPC version

This step is going to take a while (hence the suggested overclocking): Compiling and installing FPC.


1
2
3
make all OPT=-dFPC_ARMHF
make install OPT=-dFPC_ARMHF PREFIX=/usr/local
make install sourceinstall OPT=-dFPC_ARMHF PREFIX=/usr/local

Each of these steps will take a while, and a LOT of messages, including warnings, will fly by over your screen.
Just be patient until each step completes before starting the next step.

If you’d try fpc now, you’ll notice you’re still running FPC 2.6.4, and that’s not what we want. To achieve using the new version, we will need to create a symbolic link to ppcarm (which stands for Portable Pascal Compiler ARM – see this Linux man page) so it points to the right binary.

To do this, we will first need to find out what version we just installed – at the time of this writing, it’s 3.1.1. By the time you’re reading this, it might be a different number.

So let’s see what we’ve got …


ls /usr/local/lib/fpc

This should list something like this:


1
2.6.4   3.1.1   lexyacc

In this example we see that we have version 2.6.4 and 3.1.1 (the latter might be different for your situation).
Now remember that number, 3.1.1, as we need it in the following step.

In the second statement, change the number 3.1.1 for what you’ve seen in your setup:


1
2
rm -f /usr/local/bin/ppcarm
ln -sf /usr/local/lib/fpc/3.1.1/ppcarm /usr/local/bin/ppcarm

We double check the symbolic link with:


ls -l /usr/local/bin/ppcarm

It should show something like this:


lrwxrwxrwx 1 root root 31 Apr 20 13:48 /usr/local/bin/ppcarm -> /usr/local/lib/fpc/3.1.1/ppcarm

You see how it points to our new compiler (/usr/local/lib/fpc/3.1.1/ppcarm)?
If it DOESN’T, then you made a booboo with the second statement – go back to “Let’s see what we’ve got …” and try again.

If you’d try fpc  now, you’ll notice you’re still running the new FPC version (in my example: 3.1.1).

Step 5 – Install the Lazarus Pascal IDE

 Getting some additional Packages

Before we can build Lazarus Pascal IDE, we will need to install the following packages … when running the “apt-get”, just use ENTER to confirm the question if you’d like to install all this.


1
2
apt-get update
apt-get install -y libx11-dev libgdk-pixbuf2.0-dev libcairo2-dev gir1.2-coglpango-1.0 libpangox-1.0-dev xorg-dev libgtk2.0-dev libpango1.0-dev
 Download the latest Lazarus sources

This will look very similar to what we have done with FPC … so here we go:


1
2
3
mkdir /usr/local/lazarus
cd /usr/local/lazarus
svn co http://svn.freepascal.org/svn/lazarus/trunk source
 Compile the latest Lazarus Pascal IDE version

This again will be a lengthy process, so this is also a good time to read the Lazarus Wiki page on using “Lazarus with the Raspberry Pi“, specially the GPIO section looks interesting. Did you get a coke or a coffee …?

Here we go:


1
2
3
cd source
make all OPT=-dFPC_ARMHF
make install OPT=-dFPC_ARMHF PREFIX=/usr/local

If this didn’t crash somewhere, then you have finally installed the latest Lazarus IDE with the latest Free Pascal Compiler.

After compilation has completed, you should see a “lazarus” copy in the “/usr/local/share” directory.
The sources we just used can now be removed (about 1Gb worth of duplicate data):


1
rm -rf /usr/local/lazarus

Step 6 – Going to the Desktop

We will need access to the desktop of your Raspberry Pi, and with that I mean access to the windows environment (X).

You can choose one, or both of the options below.

 Option 1 – Remote access with a VNCServer (optional)

For those of us (me included) who prefer to use their regular computer to work on their Raspberry Pi, consider installing a VNCServer. In this example (taken from the Raspberry Pi documentation) we will use TightVNC server.

First download and install TightVNC Server:


1
2
apt-get update
apt-get install -y tightvncserver

The installation of ThightVNC Server will ask confirmation for installation, press ENTER to confirm.

I would want TightVNC Server to start whenever the Raspberry Pi boots, so we need to create a file in init.d for that (the “autoexec” of Linux ), which we will do with the Nano text editor:


nano /etc/init.d/vncboot

Now that Nano is open, paste the following in it:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
### BEGIN INIT INFO
# Provides: vncboot
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start VNC Server at boot time
# Description: Start VNC Server at boot time.
### END INIT INFO
 
USER=root
HOME=/root

export USER HOME

case "$1" in
 start)
   echo "Starting VNC Server"
   #Insert your favoured settings for a VNC session
   /usr/bin/vncserver :0 -geometry 1280x800 -depth 16 -pixelformat rgb565
   ;;

 stop)
   echo "Stopping VNC Server"
   /usr/bin/vncserver -kill :0
   ;;

 *)
   echo "Usage: /etc/init.d/vncboot {start|stop}"
   exit 1
   ;;
esac

exit 0

After that press CTRL+X, press “y” to confirm that you want to save it, and press ENTER to confirm the filename.

You can change the desired resolution if you’d like of course.
On my computer I prefer the 1440×900 resolution over the 1280×800, which would make line #21:


21
/usr/bin/vncserver :0 -geometry 1440x900 -depth 16 -pixelformat rgb565

Now that we have this file, we need to change the permission so that on boot it can be executed, and we will have to tell the OS about it:


1
2
3
cd /etc/init.d
chmod 755 vncboot
update-rc.d vncboot defaults

(the Raspberry Pi documentation suggest using  update-rc.d /etc/init.d/vncboot defaults , but that didn’t work for me)

As of this point you should start TightVNC Server with:


/etc/init.d/vncboot start

When starting TightVNC Server the first time, it will ask you to provide a password needed to be able to access your desktop. I would recommend using one …

A Read-Only password can be provided as well. I have no purpose for e read-only view, so I chose to answer this with “n”.

You can reboot your Raspberry Pi now, and see that TightVNC Server actually starts at boot time. But you can also wait until later. (in a Super User shell, you can simply type “reboot” to reboot)

Oh and before I forget, you can stop TightVNC Server with:


/etc/init.d/vncboot stop
 Option 2 – Boot Raspberry Pi directly into the Desktop (optional)

Accessing your Raspberry Pi remotely is nice … but using it as a standalone computer would be nice too.

For this we can use the RaspBian configuration that we have used at the beging of this project (see also Raspberry Pi Documentation for more details):


sudo raspi-config

Under option “3 Enable Boot to Desktop/Scratch” you can choose to boot in the console (shell/terminal), the graphical user interface desktop, or scratch (a simple tool for learning to program for kids).

Choose “Desktop Log in as user ‘pi’ at the graphical desktop” and select “Finish” to save the changes.

Your Raspberry Pi will now always boot in to the Desktop.

Step 7 – Running Lazarus the First Time

You can either start remote access right now, or reboot your Raspberry Pi into the Desktop – which ever you prefer.

 VNC Access

When using remote access (with TightVNC), you’ll first need to get a VNC Client – which is available for pretty much any platform you can come up with. Even versions for Android and iOS exist – even though you can argue how practical that we be.

RealVNC has versions for Windows, Linux and MacOS X, which can be downloaded for free.

VNC Viewer alternatives :

  • MacOS X users can use “Screen Sharing“, which comes with MacOS X,
  • Windows users can use “TightVNC Viewer“,
  • Ubuntu users can use “Remote Desktop Viewer” that comes with Ubuntu

 

 Starting Lazarus

Starting Lazarus is easy … simply click the menu button in the upper left corner of your RaspBian desktop. Under “Programming” you’ll find “Lazarus” – amazing right?

Start Lazarus

Start Lazarus

 Telling Lazarus where the FPC sources can be found

However,… during the first start of Lazarus, you’ll see that Lazarus cannot find it’s FPC sources …

This is only a one-time event … once set you do not have to repeat this step.

RaspBian - Lazarus can't find the FPC sources

RaspBian – Lazarus can’t find the FPC sources

Simply enter /usr/local/fpc/source  and click “Start IDE” and you’re good to go …

To do a quick test of Lazarus, I always throw a button on the form, add some on-click code and run it (i.e. press the green arrow icon in the upper left corner) to make sure everything works OK.

Note that compiling an application on the Raspberry Pi is slower than on a regular PC – so be patient.

I’ve tested if the debugger worked correctly with break-points, and I can confirm that this works very well as well.

Raspberry Pi 2 - Running Lazarus IDE

Raspberry Pi 2 – Running Lazarus IDE

 Tip: Reclaim some more disk space

RaspBian comes pretty clean, but some stuff is included that I have no use for, which can be removed saving quite a bit of disk space. With the commands below, I still assume you’re having your SSH open with a Super User (su) shell.

If not, then type “sudo su” first right after you opened a shell.

The statements below will remove some unneeded old fpc files, log files and games, and some packages like some more games, Wolfram, Scratch, Dillo, GPicView, etc.
After that “apt-get” will do a clean up.

 If you still want to use SubVersion, for example for newer FPC or Lazarus Pascal source, then please remove “subversion” from line 5 as well.


1
2
3
4
5
6
7
rm /usr/local/fpc/fpc-2.6.4.arm-linux.tar
rm -R /home/pi/python_games
cd /var/log/
sudo rm `find . -type f`
apt-get -y purge wolfram-engine scratch minecraft-pi sonic-pi dillo gpicview penguinspuzzle subversion
apt-get -y autoremove
apt-get -y clean

Additional Information

Donation options


Donations are very much appreciated, but not required. Donations will be used for web-hosting expenses, project hardware or a motivational boost (a drink or snack). Thank you very much for those have donated already! It's truly AwEsOmE to see that folks like our articles and small applications.

Comments


There are 279 comments. You can read them below.
You can post your own comments by using the form below, or reply to existing comments by using the "Reply" button.

  • Apr 24, 2015 - 7:09 AM - John Comment Link

    Awesome – just what I needed!

    OTAPI’s guide is similar, but kept crashing on my Pi2 … this worked! 

    Reply

    John

    • Apr 24, 2015 - 7:35 AM - hans - Author: Comment Link

      Hi John!

      Thanks for the positive feedback – it’s much appreciated.
      OTAPI’s manual is actually pretty good, but I kept getting error messages when trying to compile the Lazarus IDE.

      A few minor changes and optimizing some of his steps, made it work. Still not sure why .

      I also added my own “prep” steps … 

      Thanks again!

      Reply

      hans

  • Apr 26, 2015 - 1:34 AM - Anderz Comment Link

    Really good guide! Thanks!

    I have trouble adding components to the palette though. Using the “Install/Uninstall Packages” doesn’t work. I keep getting an error saying “One or more packages were not found. See package graph for details”. It also says the packages will be installed on next start. This doesn’t happen though… I have checked and confirmed that the packages are available and located exactly where they should be.

    Any idéa on how to solve this? There are a few components that I need. For example the TAChart components and the SQlite components.

    Best regards,
    Anderz

    Reply

    Anderz

    • Apr 26, 2015 - 4:19 AM - hans - Author: Comment Link

      Thanks Anderz!

      I should not take all the credit for it … but I’m glad this work for you.

      I will try to install TAChart and SQLite components, hopefully this afternoon.
      I did test anchordocking earlier, just to see if packages would be installed, and that worked just fine.

      Are these the packages you’re getting the error with?

      Reply

      hans

    • Apr 27, 2015 - 6:07 AM - hans - Author: Comment Link

      I apologize for the delay, mom’s birthday got in the way … 

      I’ve installed “sqlite3laz 0.4” without a problem. To use SQLite 3, you’ll probably also need:

      apt-get install sqlite3 libsqlite3-dev

      p.s. If you installed “sqlitelaz 0.4” as well then you might get a duplicate file error.

      Next I’ve tried “tachartlazaruspkg 1.0” and that one installed just fine as well. And even placing it on a form work fine.

      Could you please let me know which component cause the error message, and maybe post the error message as well? This would be helpful in determining what’s going on … 
      (would also be helpful for this article if this is indeed an issue)

      Reply

      hans

      • Apr 27, 2015 - 12:08 PM - Anderz Comment Link

        Thanks Hans! 

        I’ll give it another try. I might have included another component that causes the error. I’ll let you know wich component cthat is if I can figure it out. 

        Reply

        Anderz

        • Apr 27, 2015 - 2:57 PM - Anderz Comment Link

          I do get problems when installing the sqldblaz 1.0.2 package. It ends with an error saying: 

          Build IDE Exit code 512, Errors: 1
          lazarus.pp(142,42) Error: Can’t call the assembler, error -1 switching to external assembling. 

          These components are normally available in regular Windows or Linux installations of Lazarus. It’s these controls I really need…

          Reply

          Anderz

        • Apr 27, 2015 - 3:11 PM - Anderz Comment Link

          This may be caused by using Lazarus 1.5 which is not a release version… Installing 1.4 seems like a better idea…

          Reply

          Anderz

        • Apr 28, 2015 - 3:05 AM - hans - Author: Comment Link

          Haha, great … you’re running into the same error I’ve run into.

          This meant in my case that I had to increase the swap size even more.
          At least that worked for me when I started compiling the BRGA components.
          (I’ve added a warning in the swap size section yesterday addressing exactly that)

          sudo nano /etc/dphys-swapfile

          Set

          CONF_SWAPSIZE=1000

          and reboot.

          Lazarus 1.5 runs fine with my setup – but if you’d like you could try to checkout 1.4.
          I have not tested this, but I think the SVN for 1.4 would be:

          http://svn.freepascal.org/svn/lazarus/branches/fixes_1_4/

          Reply

          hans

          • Apr 28, 2015 - 1:48 PM - Anderz Comment Link

            It worked perfect! 

            Thanks! 

            Anderz

          • Apr 28, 2015 - 2:00 PM - hans - Author: Comment Link

            Awesome! 

            Was it the swapfile size?
            If so then I probably should recommend a bigger size in general in this article … 

            hans

          • Apr 28, 2015 - 2:57 PM - Anderz Comment Link

            It was the swap size that solved it. I set it to 1000 and it all works fine now. 

            I do get a warning when compiling applications though.
            “crtbegin.o not found, this will probably cause a linking failure”
            “crtend.o not found, this will probably cause a linking failure”

            The compile still works fine and the resulting application runs fine. 

            Anderz

          • Apr 28, 2015 - 3:39 PM - hans - Author: Comment Link

            I have seen those 2 warnings as well … but strangely enough, everything works just fine!

            Great to hear it’s working now! 

            On to the next article … working with the GPIO with Lazarus – I have been playing with it and it works pretty slick!

            hans

      • Feb 6, 2016 - 6:44 PM - jur - Author: Comment Link

        Hi,

        I’m a beginner. How can I find the TAchart component, and how can I install TAchart in Lazarus for RPI?

        Reply

        jur

  • Apr 27, 2015 - 5:18 AM Comment Link
    PingBack: www.recantha.co.uk

    […] Lazarus Pascal is a free Delphi look-a-like and compatible Pascal development environment based on FPC (Free Pascal Compiler). Hans Luijten from Tweaking4All.com has written a comprehensive tutorial on installing Lazarus on the Pi 2. He also includes instructions for installing it on other Raspberry Pi models, albeit an older version from the main repository. Read more here. […]

  • Apr 28, 2015 - 7:37 AM - aidv Comment Link

    I have tried OTAPIs instrutions, didnt work, I have tried yours, doesn’t work.

    It fails at the very end when istalling the IDE. Why?

    Reply

    aidv

    • Apr 28, 2015 - 8:39 AM - hans - Author: Comment Link

      Hi Aidv,

      Ehm… can you tell me what the error message is?
      Without it, I can’t really help troubleshooting.

      First and foremost; start with a clean Raspbian.
      Next follow each step to the tee – I’ve done these steps several times and found that bluntly copying the steps works best. The only point where I make an exception is with the Lazarus IDE compiling step.

      cd source
      make all OPT=-dFPC_ARMHF
      make install OPT=-dFPC_ARMHF PREFIX=/usr/local

      I always execute that one step-by-step – so I can see the errors from the “make all” line, in case any occur.

      Other tips:

      – This guide was written for a “Raspberry Pi 2 Model B“, so do not try this with a regular Model A or Model B Raspberry Pi.

      – Increase the swap file size to 1000 (versus 500) when you see this error:

      lazarus.pp(142,42) Error: Can’t call the assembler, error -1 switching to external assembling.
      Reply

      hans

      • Apr 28, 2015 - 10:22 AM - aidv Comment Link

        I tried it from the beginning, fresh install, swap size 1000, RPi2 Model B, SDHC 16GB Class 10, Power supply 2A, everything is correct,

        except at the very last step it ends with

        /usr/bin/install: cannot stat `lazarus': No such file or directory
        /usr/bin/install: cannot stat `startlazarus': No such file or directory
        Makefile:3129: recipe for target 'install' failed
        make: *** [install] Error 1
        Reply

        aidv

      • Apr 28, 2015 - 10:42 AM - hans - Author: Comment Link

        Sounds like the 2nd step (below) of the 3 steps to compile and install the Lazarus IDE failed.

        make all OPT=-dFPC_ARMHF

        Can you work your way up to that point and see what the output is?
        (I apologize – I know it takes a LOT of time to get to that point)

        Reply

        hans

        • Apr 29, 2015 - 1:39 AM - aidv Comment Link
          This time it works. I'm up and running. I think that SwapSize = 1000 does the trick.
          Reply

          aidv

  • Apr 29, 2015 - 1:21 AM - Anderz Comment Link

    I noted that when using the vnc server we actually run as user root. That is not always a good idea. I’d like to run it as user pi. How can that be done? 

    Reply

    Anderz

    • Apr 29, 2015 - 1:39 AM - aidv Comment Link

      I just noticed the same thing.

      Reply

      aidv

    • Apr 29, 2015 - 3:00 AM - hans - Author: Comment Link

      I just followed the recommendations of the Raspberry Pi Documentation and since security isn’t a big deal on my Raspberry Pi that I use for development I didn’t even bother looking at it.

      I have not tested this, but you might be able to create a “vncuser” and modify

      nano /etc/init.d/vncboot

      and modify lines 12 and 13 (replace root):

      USER=root
      HOME=/root

      Like I said: untested, because I do not have access to my stuff at the moment (traveling).

      Reply

      hans

  • May 4, 2015 - 7:25 AM - zuburr Comment Link

    make all OPT=-dFPC_ARMHF

    I take an error like this.

    Makefile:208: *** The Makefile doesn’t support target can’t-executed,, please run fpcmake first. Stop.

    root@raspberrypi:/usr/local/lazarus/source# 

    Note : My Swap size is 1000

    Reply

    zuburr

    • May 4, 2015 - 7:33 AM - hans - Author: Comment Link

      Did you maybe skip the building of FPC and making a symbolic link?
      Is this in the compile steps of FPC or Lazarus?

      What do you see when you type just “fpc” and press enter on the command line?
      Does it say version 2.6.4? Or 3.3.1?
      If it says 2.6.4 then the symbolic link did not work, or you might have skipped it.

      See Step 4 – Install the latest FPC version.

      Reply

      hans

  • May 8, 2015 - 9:36 AM - Testeurfou Comment Link

    Thank you so much !

    Coming from windows world, dealing with this linux thing on RPi2 was just a nightmare for me.

    your guide was just what i needed to start programming pascal without any knowledge of linux.

    Thanks again, you saved me so much time with this !

    Testeurfou

    Reply

    Testeurfou

    • May 9, 2015 - 2:26 AM - hans - Author: Comment Link

      Hi Testeurfou!

      You’re welcome, and I’m glad to hear that you’re working with Pascal on your RPI now … 

      p.s. especially when you’re not using the GPIO of your RPI; consider developing the program first on a regular desktop or laptop – it will go a lot faster when testing your application. I’ve done the same thing for an application I’m building.

      Once I’ve build the major GUI and functions, I transfer the sources to the RPI to then add GPIO functions and tweak things in the GUI.

      Reply

      hans

  • May 18, 2015 - 10:12 AM - Rod Comment Link

    Thanks for the guide.  Very precise and actually worked.  I had to wade through a lot of disinformation before finding this.

    You’re da man !

    One little thing I had trouble with:
    >If you’d try fpc now, you’ll notice you’re still running FPC 2.6.4, and that’s not what we want. To achieve using the new version, we will need to create a symbolic link to ppcarm (which >stands for Portable Pascal Compiler ARM – see this Linux man page) so it points to the right binary.

    Even after doing the above I couldn’t get Lazarus to compile until I ran ./samplecfg from the fpc folder. 

    Reply

    Rod

    • May 19, 2015 - 7:24 AM - hans - Author: Comment Link

      Thanks Rod! 

      Good find on the “samplecfg”! I was totally unaware of that one.
      Next time I build Lazarus, I’ll try to do that as well so I can properly document it above. 

      Reply

      hans

  • Jun 12, 2015 - 1:01 PM - BigDan - Author: Comment Link

    Found your instructions today and plan to try them shortly.

    Regarding not being able to install fpc/lazarus using apt-get on the model B, I had the same problem and found the workaround which involves fixing the sources.list file. My notes for the fix are here:

    https://bigdanzblog.wordpress.com/2015/03/10/apt-get-install-fpc-lazarus-fails-on-raspberry-pi/

    Reply

    BigDan

    • Jun 13, 2015 - 4:49 AM - hans - Author: Comment Link

      Hi Dan!

      Thanks for the info! I took the liberty of copying the info here as well, please let me know if that’s OK with you. If not, then I’ll just remove it again … 

      Apt-get install fpc lazarus fails with “fpc : Depends: fpc-2.6.0 (= 2.6.0-9+rpi1) but it is not going to be installed” on Raspberry Pi

      Evidently, something has been changed recently in Raspbian making it impossible to install FPC or Lazarus. From what I can tell, it seems to be the inclusion of a package called binutils-gold. After spending time researching the problem, I found the answer here.

      The solution is pretty simple.
      Using a text editor of your choice edit the sources.list file:

      sudo nano /etc/apt/sources.list

      Now add the line:

      deb http://plugwash.raspbian.org/wsf wheezy-wsf main

      Save source.list, apt-get update and you should be good to go:

      sudo apt-get update
      sudo apt-get install fpc
      sudo apt-get install lazarus
      Reply

      hans

      • Jun 13, 2015 - 2:23 PM - BigDan - Author: Comment Link

        Fine by me. I got your instructions to work verbatim which is excellent. Now I’m trying again, except with the stable releases of fpc/lazarus. And of course straying is not working smoothly.

        Reply

        BigDan

  • Jun 13, 2015 - 10:13 PM Comment Link
    PingBack: bigdanzblog.wordpress.com

    […] Install Lazarus Pascal RPI 2 […]

  • Jun 13, 2015 - 10:20 PM - BigDan - Author: Comment Link

    Hi Hans,

    I’ve went thru your process 3 times and it has worked great. I summarized your steps way down into something I will use regularly and then posted it on my page giving you credit. Hopefully that is OK with you.

    p.s. I didn’t realize first name/last name would be posted on your page. Could you edit my last post so the name is just BigDan. Don’t need the NSA tying all of my online activity together :-)

    Reply

    BigDan

    • Jun 14, 2015 - 5:10 AM - hans - Author: Comment Link

      Thanks BigDan,

      yes, in this case it’s OK, you at least took the effort to post a link to my website and that’s always appreciated.
      I’ll see what I can do about the name 

      Reply

      hans

  • Jun 14, 2015 - 7:20 PM - Rusty Woodbury Comment Link

    First of all, your guide is excellent. This is the best guide I’ve been able to find and your hard work is evident in the detail you supply.

    I have encountered a problem with the installation of FPC on a Raspberry Pi Model B+ with 512MB.

    If I follow the simple instructions at the start of the article FPC and Lazarus both install properly:

    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get install fpc
    sudo apt-get install lazarus

     

    But when I follow the instructions (using cut & paste as suggested) to build the latest version when I get to these commands:

    make all OPT=-dFPC_ARMHF
    make install OPT=-dFPC_ARMHF PREFIX=/usr/local
    make install sourceinstall OPT=-dFPC_ARMHF PREFIX=/usr/local

    I get multiple instances of the following exception error:

    make -C linux all
    make[7]: Entering directory ‘/usr/local/fpc/source/rtl/linux’
    An unhandled exception occurred at $0005FFC4:
    EAccessViolation: Access violation
      $0005FFC4
      $0003CE94
      $00036E94

    and the make process fails.

    I have tried setting the swap file to 1000 with the same results.

    Any ideas on what else to try would be appreciated.

    Reply

    Rusty Woodbury

    • Jun 15, 2015 - 2:21 AM - hans - Author: Comment Link

      Hi Rusty,

      thank you very much for the compliment – it’s always very much appreciated.

      As for the error you’re running into: my guess is that has to do with the target CPU?
      This article was written with the Raspberry Pi 2 in mind (blows my mind why they call it a “Raspberry Pi 2 Model B” as it’s very confusing and suggests the “Raspberry Pi Model B”, which has a different CPU).

      Maybe the info in this post is helpful?
      Or follow the tip bij BigDan?

      Reply

      hans

    • Jun 15, 2015 - 6:28 PM - BigDan - Author: Comment Link

      I was able to duplicate this problem on my Model 1 B +. After digging around some, I found if I change the OPT parameter on all of the make commands to OPT=”-dFPC_ARMHF -CpARMV6 -OpARMV6 ” then it will compile fine. As I understand it, this compiles FPC/Lazarus for version 6 of the ARM CPU which is what the Model 1 is.

      I compiled it (it took MANY hours to do this on a Model 1 B) and created a single test application which ran OK.

      Reply

      BigDan

      • Jun 15, 2015 - 6:50 PM - Rusty Woodbury Comment Link

        Big Dan,

        Thank you for the heads up on the OPT parameter..

        I’ll try that tonight and let you know.

         

        Reply

        Rusty Woodbury

      • Jun 15, 2015 - 8:23 PM - BigDan - Author: Comment Link

        1: I forgot to give my reference for figuring the above out. It is here: http://michellcomputing.co.uk/blog/2014/05/freepascal-2-7-1-on-raspberry-pi/

        2: I have found that a program compiled on a Model 2 using the procedure laid out here will NOT run on a model 1. However, code on a Model 1 WILL run on a model 2.

        Tomorrow I will try compiling the ARMV6 version of code on the ARMV7 CPU to see if that allows backward compatibility. I have quite a few Model 1 RPIs and I would like to be able to distribute software in both directions.

        Reply

        BigDan

        • Jun 16, 2015 - 9:14 AM - BigDan - Author: Comment Link

          I was able to verify that compiling FPC/Lazarus for ARMV6 on a model will allow the FPC compiler to produce code that will run on both model 1 and model 2.

          Reply

          BigDan

        • Jun 17, 2015 - 2:19 AM - hans - Author: Comment Link

          Awesome …!

          Funny finding though … shouldn’t that mean that FPC and Lazarus compiled for a Model 1 should run on a Model 2 as well?

          Reply

          hans

          • Jun 17, 2015 - 11:10 AM - BigDan - Author: Comment Link

            I would think so. I believe the Raspian Lazarus package was compiled for Model 1 and runs on both.

            If I knew how to build packages, I would package the new compiler to allow for easy installation.

            BigDan

          • Jun 18, 2015 - 1:21 AM - hans - Author: Comment Link

            Same here … I guess that’s something under Linux that could use some improvements .
            Or … could use an easier explanations that either of us could read … 

            It actually makes me wonder who maintains the FPC/Lazarus package …

            hans

          • Jun 18, 2015 - 1:28 AM - hans - Author: Comment Link

            Or I should have used Google … 

            I found this link in the Lazarus Wiki – How to build a Debian Package.
            I’d test it myself, but unfortunately I have no Raspberry Pi laying around (still somewhere between the US and Europe).

            It “looks” pretty simply, but when reading it, I’m not sure if it does only FPC or FPC and Lazarus in one package, and you’d need to compile FPC (and Lazarus?) before one would be able to do this.

            From the Lazarus Wiki:

            Important: This script does not create the official debian/ubuntu packages. It creates a fpc package that contains the compiler and all packages.

            To build the package you need to install some packages:

            sudo apt-get install libgpmg1-dev fakeroot libncurses5-dev build-essential

            Go into your lazarus source directory. The directory must be writable.

            cd ~/freepascal/lazarus/tools/install
            ./create_fpc_deb.sh fpc ~/freepascal/fpc

            If you get an error about a missing file or tool you may have to install a missing package. If you get a compilation error your installed fpc is not the released compiler or you were unlucky and fetched a fpc svn reversion that contains a bug. Search help on the mailing list, forum or chat. If it ran through you now have a deb file, which you can install:

            sudo dpkg -i fpc_2.5.1-091121_i386.deb

            The file name is different for you.

            Note : When I tried this in a VM Linux distro, I couldn’t even find the initial path. So info might be missing. Or my Linux distro did not have the complete stuff.

            hans

          • Jun 18, 2015 - 1:32 AM - hans - Author: Comment Link

            I should have looked a little more before posting … 

            Also from the Lazarus Wiki – How to setup a FPC and Lazarus Ubuntu Repository (setting up the repository itself might not be what we need, but it does explain how to build the .deb packages).

            hans

          • Jun 18, 2015 - 11:26 AM - BigDan - Author: Comment Link

            Very cool. I need to work on other stuff, but I’ve added this to my todolist to try when I have some time. If I get it to work, I’ll report back.

            BigDan

          • Jun 19, 2015 - 8:08 AM - hans - Author: Comment Link

            Awesome! 

            As soon as my gear arrives, I’ll start working on that as well – it will take a few weeks though before my stuff arrives.
            But when I get to it: I’ll report back here as well! (and post the .deb file for download if either of us gets it to work)

            hans

      • Jun 16, 2015 - 2:31 AM - hans - Author: Comment Link

        Thanks BigDan for posting the solution for Model 1 Pi’s! 

        As far as I understand the model 1 has an ARM v6 and the model 2 has an ARM v7 CPU.

        Now we can only wait for FPC to automatically use multiple cores so we see some serious speed increase.
        When developing apps for the Raspberry Pi, except for the PIO pins, I always do the majority of the work on a regular computer (Mac, Windows, Linux) since compiling takes a while each time you’d want to test some code.

        After that I move the sources over the RPI and finish the RPI specific parts.

        Reply

        hans

        • Jun 18, 2015 - 4:39 PM - Rusty Woodbury Comment Link

          Hans, BigDan,

          Thank you for your help. Your advice and links saved me an incredible amount of time.

          I got a Raspberry Pi 2 Model B, built the FRC on it and then modified it to build for the Raspberry Pi Model B+.

          I can now write Pascal code that will run on either platform which is nice since I’m generating code for an array of Raspberry Pi processors that might contain any of the different Raspberry Pi models.

          Rusty

          Reply

          Rusty Woodbury

        • Jun 19, 2015 - 8:08 AM - hans - Author: Comment Link

          Cool! You’re welcome Rusty! 

          Reply

          hans

  • Jun 15, 2015 - 1:10 PM - Rusty Woodbury Comment Link

    I think you’re correct.

    The B+ has a single core processor (ARM 6) while the Raspberry Pi 2 Model B has a quad core processor (ARM A7/A15).

    The exception error probably comes when the compiler tries to use some feature not present in the A6.

    I’ll look at the make files to see if they can be modified to avoid this problem.

    In the mean time I’ll try to use FPC 2.6.4 or just get a RasPi 2 Model B.

    Thanks for your help, keep up the great work.

    Reply

    Rusty Woodbury

  • Jun 21, 2015 - 10:27 AM - BigDan - Author: Comment Link

    I tracked down how to correct the linking error indicating ‘crtbegin.o’ and ‘crtend.o’ are not found.

    The compiler needs to know where to find the gcc library.

    To determine the directory I use:

    sudo find / -name crtbegin.o

    It found the file in /usr/lib/gcc/arm-linux-gnueabihf/4.6

    Now you need to add that library to /etc/fpc.cfg. Type (or use the editor of your choice)

    sudo vi /etc/fpc.cfg

    Search for the comment “# path to the gcclib”. You will find there is no library listed under this comment. Add the library directory above like this:

    # path to the gcclib
    -Fl/usr/lib/gcc/arm-linux-gnueabihf/4.6

    Reply

    BigDan

  • Jun 29, 2015 - 10:42 PM - BigDan Comment Link

    Just a head’s up:

    After building a current compiler for my Raspberry Pi, I decided to build a current cross as well. My old one dates back to Lazarus 9.8. I documented concise instructions to build the cross compiler here

    https://bigdanzblog.wordpress.com/2015/06/29/building-free-pascal-lazarus-cross-compiler-for-raspberry-pi/

    Reply

    BigDan

    • Jul 1, 2015 - 1:21 AM - hans - Author: Comment Link

      Hi BigDan!

      Thanks for the write-up and for posting the link! 

      If I understand the article right; this is to develop and compile Raspberry Pi Apps under Linux.
      Would it be capable of developing using GPIO? Or not (which I assume)?

      Right now I develop on a Mac, minus GTK2 and GPIO specific code. Then move the code to the Raspberry Pi and add the missing GPIO/GTK2 stuff – would not mind doing this in an easier way.

      Reply

      hans

      • Jul 1, 2015 - 2:44 PM - BigDan - Author: Comment Link

        My normal flow is to maintain the code on an linux i386 box. When I compile, I have a command in the compile script that transmits the object code to the RPI and I test it there. I will be updating my post, shortly, to describe those settings.

        Also, sadly, I have found the same stupid bug still exists in the cross compiler that messes up GUI fonts which really makes cross compiling worthless for GUI apps (which I don’t normally write but I am trying to write one now). I’ll document that further in my post as well.

        Reply

        BigDan

      • Jul 2, 2015 - 1:18 AM - hans - Author: Comment Link

        Thanks BigDan!

        Yeah, the “font” issue seems a common theme with all cross platform development [with Lazarus].
        I’ve had my share of issues with that as well. Wait until you start using a HighDPI screen (ie. Apple Retina screen for example) … 

        Reply

        hans

  • Jul 30, 2015 - 3:09 AM Comment Link
    TrackBack: www.quora.com

    Lazarus FPC is alive and well. Cross-platform!

  • Jul 31, 2015 - 8:33 AM - Mike Chapman - Author: Comment Link

    Hi,

    I have an ethernet enabled device that has a driver written in Pascal.  I’m keen to get this device onto a Raspberry PI.  I have a Pi 2 Model B 1GB (box label).  I’ve been stuffing around trying to get Pascal running and eventually ended up at this site.  I’m having trouble getting Lazarus to compile, the error I’m getting is :-

    pi@raspberrypi /usr/local/lazarus/source $ sudo make all OPT=-dFPC_ARMHF

    make -C packager/registration

    make[1]: Entering directory '/usr/local/lazarus/source/packager/registration'

    /bin/rm -f ../units/arm-linux/fcllaz.ppu

    /usr/local/bin/ppcarm -MObjFPC -Scghi -O1 -g -gl -l -vewnhibq -Fu. -Fu/usr/local/lib/fpc/3.1.1/units/arm-linux/rtl -FE. -FU../units/arm-linux -dFPC_ARMHF -darm fcllaz.pas

    Hint: (11030) Start of reading config file /etc/fpc.cfg

    Hint: (11031) End of reading config file /etc/fpc.cfg

    Free Pascal Compiler version 3.1.1 [2015/07/28] for arm

    Copyright (c) 1993-2015 by Florian Klaempfl and others

    (1002) Target OS: Linux for ARMHF

    (3104) Compiling fcllaz.pas

    (3104) Compiling registerfcl.pas

    /usr/local/lazarus/source/packager/registration/registerfcl.pas(45,22) Fatal: (10022) Can't find unit process used by RegisterFCL

    Fatal: (1018) Compilation aborted

    Makefile:2299: recipe for target 'fcllaz.ppu' failed

    make[1]: *** [fcllaz.ppu] Error 1

    make[1]: Leaving directory '/usr/local/lazarus/source/packager/registration'

    Makefile:3050: recipe for target 'registration' failed

    make: *** [registration] Error 2

    I hope someone can help.

    This is probably the 2nd or 3rd attempt at Lazarus so I hope I don’t need to restart at the very beginning with fpc.  I in fact installed (using apt-get) the earlier version of Lazarus after compiling the latest fpc (3.1.1).  Lazarus runs but the code for the driver uses about 5 other libraries, I since forgotten some are ‘lazutils’, another about printers Laz4printers ???

    Looks like most of us with the Pascal need – end up at this page – invaluable.

    Cheers,

    Mike Chapman

    Reply

    Mike Chapman

    • Jul 31, 2015 - 10:00 AM - hans - Author: Comment Link

      Hi Mike!

      I wouldn’t call this page invaluable, but I do very much appreciate the thought .

      I know “LazUtils” is a standard component for Lazarus. This makes me wonder if your path (to the component sources) set correctly in Lazarus IDE. Now, I do not have access to my RPI right now, so I cannot verify the exact path you’d need. But this is where I would start looking.

      I hope others can chime in as well … oh and of course you’re familiar with the official Lazarus Forum, there are some quite helpful people there as well.

      Sorry I could not be of more help … 

      Reply

      hans

    • Aug 1, 2015 - 12:42 AM - Mike Chapman - Author: Comment Link

      Had another attempt, starting from building fpc, this time I set to superuser using ‘su sudo’  earlier I had executed the commands using ‘sudo’.  I made through to the lazarus install where I ran out of space.  So I did a ‘make clean’ from lazarus and rip the install again, this time it worked.  I even get Lazarus up without the warnings of missing packages.  Still having issues on build/compile.  Like:

      Compile package FCL 1.0.1: Exit code 256, Errors. 1

      * registerfcl.pas(45,28)Fatal: Cannot find process used by RegisterFCL of package FCL.

      Maybe this is simply a pascal coding thing and nothing else.

      Cheers,

      Mike Chapman

      Reply

      Mike Chapman

      • Aug 1, 2015 - 1:29 AM - Mike Chapman - Author: Comment Link

        Actually, a closer reveals that I may well have the latest versions of fpc and Lazarus, I’m still getting the original problem, missing packages showing as required in the Project Inspector :- LazUtils, FCL, Printer4Lazarus, TAChartLazarusPkg, SynEdit, LCL.  So do I need to get these from somewhere, or is it likely I already have just can’t see them?

        Cheers,

        Mike

        Reply

        Mike Chapman

        • Aug 1, 2015 - 3:12 AM - hans - Author: Comment Link

          You most likely have them and for example LCL is required … even if it’s just to start/compile the IDE.

          Reply

          hans

      • Aug 1, 2015 - 3:12 AM - hans - Author: Comment Link

        Hi Mike,

        I didn’t know SU and SUDO would result in different user access – I always was under the impression that both triggered root access. SU being a shell and SUDO for a single command. 

        Either way, Lazarus cannot find the sources of it’s packages,… I’d really start looking in the settings in the IDE.
        Most certainly LazUtils, SynEdit and LCL are standard Lazarus components.

        Check “Tools” – “Options” – “Files”, I suspect that “Lazarus Directory” is not correct, … “LCL” should be in that directory, and so should the directory “components”. Check the Lazarus directory also to make sure those directories exist.

        The components other packages, TAChartLazrusPkg (dir: components/tachart), SynEdit (dir: components/synedit) and Printer4Lazarus (dir: components/printers), should be there too. FCL I am not familiar with (could this be: components/pascalscript ?). But this is what I found in my Lazarus directory.

        Did you maybe relocate Lazarus after compiling it?

        Reply

        hans

  • Aug 3, 2015 - 7:25 PM - JimKueneman Comment Link

    You are the man!.  This was clear and to the point.  Worked perfectly.  One note to add to it is another reason you can get a 

    can’t call the assembler, error -1

    is because you have dorked around with the GPU memory in the initial configuration.  I set it to 256 (default 64) and that caused this error as well.

    Jim

    Reply

    JimKueneman

    • Aug 4, 2015 - 3:12 AM - hans - Author: Comment Link

      Thanks Jim! 

      Thanks for the tip – I had never played with the GPU memory in the config.txt file, but it’s good to know that this has an effect as well.

      For those interested, read more here

      Did you notice any advantages in increasing the GPU memory (performance wise)?

      Reply

      hans

      • Aug 4, 2015 - 8:19 AM - JimKueneman Comment Link

        Since I don’t use it to play games I can’t speak to that but to write code it made not noticeable positive difference!

        Jim

        Reply

        JimKueneman

  • Aug 18, 2015 - 1:07 PM - Doug Comment Link

    Worked with a pi2 and a sandisk 8gb card……With all the thousands of dependencies having it work is like finding a snowball at the equator.

    Reply

    Doug

    • Aug 19, 2015 - 3:08 AM - hans - Author: Comment Link

      Hi Doug!

      Great to hear it worked for you as well. 
      Yeah, I know the snowball problem, one of the reasons why Linux is not (yet) one of my main OS’es … 

      Reply

      hans

  • Aug 25, 2015 - 3:02 AM - Alzibiff Comment Link

    Thank you from someone who has recently finished full time work and is getting back into electronics and programming after many many years of doing none of it! (Although I started 3D printing a couple of years ago!).

    Tutorials like this are invaluable to people like me who have a base knowledge which has not kept up to date as the technology has expanded over the years. I didn’t understand most of the steps but thanks to your very well written instructions, I now have a Visual Pascal system which works on my new RPi, (I managed to compile and run a two button, one label, one edit box program without any problem) AND some bits of Linux command knowledge which I didn’t have before.

    What I need to do now is find out how to install BigDan’s “wrapper” code for WiringPi so that I can get to grips with the GPIO pins. I used to teach Delphi back in 1995 before I left programming behind but there a are a lot of new terms around now that I have never come across which makes things a wee bit ‘challenging’ :-)

    Top work – thank you again,

    Alan

    Reply

    Alzibiff

    • Aug 25, 2015 - 3:27 AM - hans - Author: Comment Link

      Hi Alan,

      thank you very much for the kind compliment – you have no idea how motivating that can be! 

      Thanks again! And let us know what kind of fun projects you’ll create! 

      p.s. I’m not an expert either, but I do love dabbling in stuff like this … so one of the reasons to write articles like this (besides receiving great feedback) is that I run in to wee bit challenges as well … 

      Reply

      hans

  • Oct 2, 2015 - 6:36 PM - BosseB Comment Link

    I found this How-to when trying to set up a Lazarus/fpc environment on a RPi2B.
    The purpose is to create a control program for RPi2 based on a number of source files from Delphi7/2007 in Windows.
    So it was natural to try the Lazarus/FPC route….

    I have followed the steps successfully until this command:

    make all OPT=-dFPC_ARMHF

    It chugs along for quite a while and then outputs this error after doing 53% of the job:

    [ 53%] Compiled package utils-fprcp
    Start compiling package utils-h2pas for target arm-linux.
    Executing command "/usr/local/bin/plex h2pas/scan.l h2pas/scan.pas"
    The installer encountered the following error:
    External command "/usr/local/bin/plex h2pas/scan.l h2pas/scan.pas" failed with exit code 256. Console output:
    TP Lex Version 4.1a [April 2000], Copyright (c) 1990-2000 Albert Graef
    FATAL: cannot open file /usr/lib/fpc/lexyacc/yylex.cod
    Makefile:2403: recipe for target 'all' failed
    make[2]: *** [all] Error 1
    make[2]: Leaving directory '/usr/local/fpc/source/utils'
    Makefile:2650: recipe for target 'utils_all' failed
    make[1]: *** [utils_all] Error 2
    make[1]: Leaving directory '/usr/local/fpc/source'
    Makefile:2895: recipe for target 'build-stamp.arm-linux' failed
    make: *** [build-stamp.arm-linux] Error 2

    It seems to me to be a deficiency in the sources downloaded by svn, but I am not sure.

    Notice I am using Raspbian-Jessie because that was the latest version of Raspbian.
    And I have set swap to 1000.

    What could be the reason for this error???

    Reply

    BosseB

    • Oct 3, 2015 - 4:04 AM - BosseB Comment Link

      UPDATE:

      I pulled the SDcard from the RPi2 and created a new system using the Raspbian-Wheezy image from 2015-05-05 instead.
      With this image the error does not appear on make of FPC.

      I have now executed all of the steps without error to the end. :)

      Lazarus is running on my Pi2B and I can interact via TightVNC, just exactly like I wanted to!

      THANK YOU VERY MUCH FOR THIS INVALUABLE TUTORIAL!!!!!!!!

      Reply

      BosseB

    • Oct 3, 2015 - 4:22 AM - hans - Author: Comment Link

      Hi BosseB!

      Awesome! Glad to hear you’ve gotten it to work! And thanks for the great compliment! 

      Reply

      hans

      • Oct 4, 2015 - 2:32 AM - BosseB Comment Link

        I was too quick!

        I found out that when following your instruction for setting up VNC the resulting VNC GUI shell runs as root, which is not what we want…

        What you need to do is the following:

        1) Installation of tightvncserver
        do this as user pi in pi:s home dir:

        sudo apt-get install tightvncserver
        tightvncserver  (in order to run for the first time and set up the environment including logon password)

        2) Create the /etc/init.d/vncboot script
        Proceed as in your description but use this script instead (changes are USER and HOME values and a su command in the vncserver line):

        #!/bin/sh
        ### BEGIN INIT INFO
        # Provides: vncboot
        # Required-Start: $remote_fs $syslog
        # Required-Stop: $remote_fs $syslog
        # Default-Start: 2 3 4 5
        # Default-Stop: 0 1 6
        # Short-Description: Start VNC Server at boot time
        # Description: Start VNC Server at boot time.
        ### END INIT INFO
         
        USER=pi
        HOME=/home/pi

        export USER HOME

        case "$1" in
         start)
           echo "Starting VNC Server"
           #Insert your favoured settings for a VNC session
           su - pi -c "/usr/bin/vncserver :0 -geometry 1280x800 -depth 16 -pixelformat rgb565"
           ;;

         stop)
           echo "Stopping VNC Server"
           /usr/bin/vncserver -kill :0
           ;;

         *)
           echo "Usage: /etc/init.d/vncboot {start|stop}"
           exit 1
           ;;
        esac

        exit 0

        Set the script permissions etc as described.

        3) If you need to change the installation after it is already active as root (like I had to) then:

        You must first stop the running server and then move any existing .vnc dir in the pi home dir.

        cd /home/pi
        sudo su
        /etc/init.d/vncboot stop
        mv .vnc .vnc.old

        Next switch back to user pi and run the server once manually and enter the password when requested:

        tightvncserver

        Then you could edit the vncboot script as above and activate its changes and restart the server with:

        update-rc.d vncboot defaults
        /etc/init.d/vncboot start

        I think this should solve the problem.

        In any case I advice to modify the description such that the logon user for the VNC window becomes pi rather than root.

        Reply

        BosseB

        • Oct 4, 2015 - 3:14 AM - hans - Author: Comment Link

          Thanks BosseB for the good explanation.
          I have to admit that I just followed the Raspberry Pi documentation on the VNC part.

          For a developer it might not be too bad (on a Raspberry Pi) to just have root access, but in certain scenario’s I can imagine that it might be better to use te user “pi”. 

          Thanks for the excellent tip! 

          Reply

          hans

  • Oct 10, 2015 - 3:20 AM - BosseB Comment Link

    Hi again,

    I have now repeated the steps in this tutorial (with my slight modifications regarding VNC) 4 times and it works just fine on Raspbian-wheezy.

    But on Jessie I did not succeed…
    Did you try to complete the installation also on Jessie so you can confirm that it is possible?

    I will try once more using a blank 8GB SDcard today and note what goes wrong.
    I know already that the VNC installation will require modification because the Jessie default is to boot into the GUI and this reserves display :0.

    Reply

    BosseB

    • Oct 10, 2015 - 8:04 AM - BosseB Comment Link

      I have now tested to do the installation on Jessie.

      Started with an 8GB card but then I got an error while compiling the lazarus IDE, which indicated that I needed more swap.
      But when I tried to increase swap from 1000 to 1500 Raspbian became sluggish even at logon so I checked disk usage and it was too small.
      So I transferred the image to a 16 GB card instead and then I could actually compile to the end without errors even with swap set to 1000.

      I started the installation with the default setting for boot (boot to GUI with pi logged on) and this forced me to install tightvncserver to operate on display :1 rather than :0.
      When I received the compile error I changed the boot option to only boot to the command line interface.
      So when I finally succeeded in compiling both FPC and Lazarus the Pi was set to boot to the command line. I did all work via the PuTTY SSH shell.

      The problem now remaining for Lazarus is that unlike what happened in Wheezy when I compiled and installed Lazarus there is no Menu item Programming/Lazarus to actually start lazarus from! It seems like this time it was not created even though that happened when I installed on Wheezy.

      Do you have any idea what caused this or what I could do in order to start Lazarus?

      Reply

      BosseB

    • Oct 11, 2015 - 2:27 AM - hans - Author: Comment Link

      Hi BosseB,

      I have yet to try to do this on Jessie.
      Did you do a clean install or follow the upgrade path as suggest here?
      There are two factors that play a role: the system and the FPC/Lazarus version.
      Now we know the system is a newer version, which version are you using for FPC and Lazarus IDE?

      Since you’re missing the “shortcut” to Lazarus, you can run “startlazarus” or “lazarus” from the commandline. You should be able to find it in the Lazarus install directory, since I do not have a RPI at hand right now, you should be able to start it with something like:

      /usr/local/lazarus/startlazarus
      Reply

      hans

      • Oct 11, 2015 - 4:27 AM - BosseB Comment Link

        I did a clean install from a downloaded Jessie image so there should be no problems due to faulty migration or such.

        I followed the installation steps here (again) and now the svn downloads got me revisions fpc=3200, lazarus=50023
        So those are the bleeding edge versions from svn trunk as of yesterday.

        I should also add that in order to complete the lazarus compile without errors I had to set swap to 1000 as suggested here but also configure the Pi to boot into the CLI so it does not use up so much RAM for its GUI. After compile I changed back to boot into the GUI.

        It IS possible to start Lazarus from the Menu in a roundabout way:
        Menu/Run…
        Then type in laza and some wizard suggests lazarus-ide, which I select and Lazarus starts up.
        But it is really an awkward way of starting a GUI program.

        Once started it works all right in my tests so far. I have checked that I can manipulate GPIO pins using the pigpio.pas driver obtained from the lazarus wiki, although I had to modify it for the RPi2 hardware differences (address of the GPIO for example). I also added defines for the Pi connector pins so they could be matched up correctly. The defines used in the pigpio example are wrong in 4 cases…

        Reply

        BosseB

      • Oct 11, 2015 - 4:30 AM - BosseB Comment Link

        Note:

        /usr/local/lazarus is a dir that does not exist!

        I have in fact no idea where the install scripts placed lazarus…..

        Reply

        BosseB

      • Oct 12, 2015 - 3:46 AM - hans - Author: Comment Link

        I’ve tried to locate my Lazarus SD card for my RPI, in the hope that I could locate Lazarus there, but (due to a recent move from the US to the EU), I somehow have misplaced it.

        You could try straight from Terminal:

        startlazarus

        Or try to locate it in (maybe) one of these directories:

        /usr/share/lazarus
        /usr/share/lazarus/install/Lazarus

        Not sure why there is no shortcut, but I guess that’s part of the nature of Linux being slightly different for each distro.

        Reply

        hans

        • Oct 12, 2015 - 4:37 AM - BosseB Comment Link

          Very strange, must be a mistake in Jessie…

          I installed cvs and cervisia in order to use the company version control system.
          As a side effect of this installation Lazarus at last appeared in the Menu/Programming sub-menu!!!!

          But Cervisia is now the program missing from the Menu. Have to start it from Menu/Run.

          Extremely strange, it seems like the last installed GUI program is always missing from the start Menu (not a great statistical sample though…). But it will appear if another GUI program is installed.
          How could that happen? Or did the install of Cervisia co-inside with me having started Lazarus enough times from the Menu/Run.. function?

          Maybe I should post a report in the Raspbian subforum at RPi?

          Reply

          BosseB

        • Oct 13, 2015 - 3:38 AM - hans - Author: Comment Link

          That’s weird indeed.

          With Wheezy it always seems to install in the menu.
          I’m just not sure if it is the Lazarus install script that adds it, or if the Window/Menu manager of Wheezy is doing this.

          Maybe it was just a delayed “update” of the menu?

          If you ask in the RPI forum, which is a good idea, and you find out what the deal is, would you mind posting it here? 

          Reply

          hans

          • Oct 13, 2015 - 7:28 AM - BosseB Comment Link

            I got a reply that located a menu handler program. It is apparently written in Python and it can be found here: Menu/Preferences/Main Menu Editor

            When I opened it it allows navigation to different parts of the Main Menu tree so I looked at the Programming subnode. Surprise! Cervisia was present there and checked but still it did not show up on the Menu. I even rebooted after finding this but still no Cervisia on the Menu.

            Next I tried this:
            – In Main Menu Editor I unchecked Cervisia
            – Waited a bit (seemed like “something” was being done
            – Checked the checkbox again and closed the dialog with the OK button

            Amazingly now the Cervisia entry showed up in the Programming submenu!

            So to make an invisible newly installed application show up you seem to have to do either:
            A) Install another GUI application, this makes the previously installed program visible
            or
            B) Open the Main Menu Editor and uncheck the missing program, then check it again

            To me this sounds like a bug to me and this is what I also reported in the Pi forum.

            BosseB

          • Oct 13, 2015 - 7:41 AM - hans - Author: Comment Link

            Sounds like a little bug indeed … weird.

            hans

  • Oct 14, 2015 - 7:47 PM - Chris Comment Link

    Is anybody else experiencing the problem that after this process the user pi has no access to lazarus files?  I can’t install any components as user pi and in fact, lazarus doesn’t show up in user pi’s start menu.  If I run: sudo startx, then it comes up in the start menu and components can be installed, but I’m loathe to setup the RPi such that I have to run LXDE as SU.

    I’ve tried changing the permissions for everything in the /usr/local/share/lazarus directory, but that seemed to create new problems.

    Anybody else? What am I doing wrong?

    Reply

    Chris

    • Oct 15, 2015 - 12:09 AM - hans - Author: Comment Link

      I login with root through VNC, so I cannot confirm the issues you run into.
      I’ve seen another user (BosseB) use the user “Pi”, maybe he has more experience with this.

      Reply

      hans

    • Oct 15, 2015 - 12:55 AM - BosseB Comment Link

      I am following the discussion on the Lazarus mail list and while reading that I have realized that the procedure outlined here has to be modified regarding the permissions used during install.

      Basically what they say is that Lazarus should be installed by user pi rather than su. I am preparing to do so but I have put some questions there to clarify how I could rectify the way the installation is done now.

      But these seems to be the main steps after having built the fpc compiler on the Pi:
      Exit su mode to get to the pi prompt first!

      # exit
      $ mkdir /home/pi/development
      $ cd /home/pi/development
      $ svn co http://svn.freepascal.org/svn/lazarus/trunk lazarus
      $ cd lazarus
      $ make bigide  <== From Juha Manninen on the Lazarus list

      I don’t know how to get rid of the installation I did as su, so I cannot do the above just yet, but I will make a test later tonight.

      Mind you, I can use Lazarus as it is right now, but I have not tried to modify the IDE like you have so I did not run into that problem (yet).

      Concerning Pi access, I already found that I have to change the way VNC is installed in order to make it run as pi rather than root. That is not so difficult really, one just have to modify the procedure a bit and switch to user pi when starting up the VNC server.

      If you run Raspbian Jessie there are a few gotchas right there!
      1) The procedure to get the tightvncserver start at boot does not work because Jessie uses a different boot manager (systemd) where the way to start stuff apparently has changed a lot. Issue not yet solved. So after each boot I have to log on using SSH and start the VNC server as pi (I use a shell-script file for that).

      2) Any program installed in Jessie does not show up in the start menu until the next GUI program has been installed! However, there is a workaround for this:
      Open Menu/Preferences/Main Menu Editor and go to the Programming section. Here you will find Lazarus checked and yet it does not show up… Now, uncheck Lazarus, wait a few seconds and then check it again. Finally hit OK. Now you should find Lazarus on the start menu. I have asked about this on the Pi forum and it is confirmed as a bug.

      I will be back here and report the solutions once I am done with the new procedure.

      And another note for Jessie:
      Due to the size of Raspbian Jessie I failed to install Lazarus on an 8GB card. Ran out of disk space during compile…
      The minimum size for Jessie seems to be 16GB. And I had to change the boot sequence to boot into the CLI rather than GUI in order to do the compile step. Jessie defaults to boot into the GUI if one does not change it.

      Reply

      BosseB

    • Oct 15, 2015 - 2:05 PM - hans - Author: Comment Link

      Awesome write up BosseB! Thanks for taking the time and posting it here! 
      I have not worked with Jessie yet … and not with systemd either haha …
      You’ve been searching quite a bit, so maybe you’ve already read this concerning systemd (both are TigerVNC related, but the regular vncserver probably starts the same way): Starting and stopping vncserver via systemd?  Or maybe this read concerning RedHat (works similar – it all starts to look very much Apple-like).

      I’m kind-a curious what the Jessie advantages will be over Wheezy …?
      (just being curious)

      Reply

      hans

  • Oct 15, 2015 - 2:32 PM - Chris Comment Link

    Thanks BosseB.  Yes, I’m using Jessie as well and I found out about the 16gb the hard way.. It failed to make on the 2nd to last step so I had to start over with a larger sd card.

    For the Lazarus menu button, I had do what you said about the menu settings but then also reboot… it wouldn’t come back without the reboot.

    As for the permissions.. I’m running everything as root now.  If I have time, I’ll try to start over and install Lazarus after exiting sudo.  When I tried to change ownership of the lazarus directory to pi, I ran into a bunch of new problems, so it seems that reassigning the permissions after the fact is a little more involved.

    Thanks Hans for your time to document this.  If installing Lazarus as pi works, I’d recommend updating the workflow accordingly.

    Thanks again!

    Reply

    Chris

  • Oct 15, 2015 - 3:38 PM - BosseB Comment Link

    Following advice on the Lazarus list I have now done this all as user pi:

    1) Renamed the old installation dir to disable it as follows:

    sudo mv /usr/local/share/lazarus /usr/local/share/lazarus_old

    2) Create a folder /home/pi/development
    3) Check out lazarus trunk from subdir development into lazarus (got svn
    50059 this time)

    svn co http://svn.freepascal.org/svn/lazarus/trunk lazarus

    4) Reconfigure Pi to boot to the command line interface to save memory
    and reboot.
    5) Go to ~/development/lazarus and run:

    time make bigide

    This completes in about 17 minutes as reported by time
    6) Start tightvncserver and log on to the GUI via VNC
    7) Now try to run Lazarus. The Menu item does not work since it points to the disabled version.
    So I used the Menu/Preferences/Maqin Menu Editor to add a new item for Lazarus where I navigated to ~/development/lazarus/startlazarus as the command to run. I could not find a way to add the Lazarus icon to the command, though.

    When I now use the new Menu command for Lazarus it shows a big dialog telling me that it has detected a new Lazarus in use and do I want to transfer the settings to this Lazarus? I reply yes and then another dialog is shown where the file paths for Lazarus are checked to be OK. Then finally Lazarus starts up. I got another error dialog about some macros, which I don’t know the reason for. Seems not to make my program misbehave though.

    Now one can do a svn update in the lazarus dir and then rebuild Lazarus from its menu Tools/build Lazarus…

    The last step for me now is to remove the disabled version of Lazarus from the disk.

    Reply

    BosseB

  • Oct 16, 2015 - 5:01 AM - hans - Author: Comment Link

    Thanks BosseB and Chris,

    I’ll try Jessie in the very near future and take the tips from BosseB to rewrite it for the “pi” user (vs root).
    Maybe I see a few things that address the macro issue.

    I do recall however, that running svn might actually require root, and maybe that macro issue is the reason why.
    I have to go find my RPI2 again and make some time to do all the steps again.

    Thank you both for the excellent information! 

    Reply

    hans

    • Oct 16, 2015 - 7:04 AM - BosseB Comment Link

      No, svn does not require root to run.

      I have used svn co to get the lazarus sources into the Pi home tree and it works just fine.

      Compiling lazarus as Pi also works fine, what I have had problems with now is to get Lazarus onto the Menu…
      After a number of iterations I found that Main Menu Editor had placed a number of start items for Lazarus under “Other”…

      Go figure…..

      Reply

      BosseB

    • Oct 17, 2015 - 3:44 AM - hans - Author: Comment Link

      Ah, then the root issue must be MacOS specific, my bad.
      Good to know that you’ve gotten it to work as “pi”, well minus the menu incident of course haha.

      If this is a bug, then you might want to start a thread at the Lazarus Forum (Installation – Linux) as well,…
      I’m sure you would not be the only one running into this issue.

      Reply

      hans

  • Nov 1, 2015 - 8:53 PM - DonB Comment Link

    Thanks for a great installation guide.  Must have been a lot of work…works great.  I’m new to Linux, Raspberry, and Lazarus but have used Delphi.  After installation, there was no entry in the desktop menu items.  I can run Lazarus from the ‘RUN’ menu item and it seems to work OK.  Is there an easy way to add it to my ‘Programming’ menu item or the desktop?

    Thanks.  Great job.

    Don

    Reply

    DonB

    • Nov 2, 2015 - 2:50 AM - hans - Author: Comment Link

      Hi Don,

      thanks for recognizing that it takes a lot of work haha. Yeah even the smaller articles take up to 2 days of work (research, test and try, write, create graphics, and I translate it to a Dutch article afterwards as well). But I do enjoy it a lot . Wish this could be my daytime job .

      As for adding a menu item;
      Unfortunately I do not have a running setup at the moment (still catching up after my big move to Europe).

      Assuming Raspbian, as far as I could find (source or the source he used) – please let us know if this is helpful:

      How to add menu items to the start menu of your Raspberry PI?


      The menu files for the start menu are stored in the directory:

      /usr/share/applications

      (with the .desktop extension)


      Let’s say you want to add Processing to the ‘Programming‘ section of the start menu:


      rpi_startmenu


      create a 32 x 32 pixels .png icon for the application and save it to

      /usr/share/pixmaps/


      create a new desktop file:

      sudo nano /usr/share/applications/Processing.desktop

      enter the following lines of text:


      [Desktop Entry]

      Type=Application

      Name=Processing

      Comment=Processing programming language

      Icon=/usr/share/pixmaps/processing.png

      Exec=/home/pi/processing-1.5.1/processing

      Terminal=false

      Categories=Development;


      restart the lxde environment by typing:

      lxpanelctl restart


      Reply

      hans

  • Nov 5, 2015 - 10:52 AM - BosseB Comment Link

    I tried to comment on the discussion here a few days ago but whenever I hit Submit I was brougt to a completely different part of your website and my comments vanished. Is this solved now so I can contribute?

    Reply

    BosseB

    • Nov 5, 2015 - 12:07 PM - hans - Author: Comment Link

      Ehm, that doesn’t sound good … maybe this happened while we moved to a different webserver.
      Seems to work now 

      Reply

      hans

      • Nov 8, 2015 - 9:45 AM - BosseB Comment Link

        Happened again when I tried to add a post about getting release versions of FPC and Lazarus working in Pi2.

        When I hit Submit Reply I was brought to the top opf the page and my post was nowhere to be seen!

        Reply

        BosseB

      • Nov 8, 2015 - 9:45 AM - BosseB Comment Link

        No it does not.

        Reply

        BosseB

      • Nov 8, 2015 - 11:02 AM - hans - Author: Comment Link

        Seems that way.

        I post my replies here all the time (at least once a day I go through all the comments, sometimes twice a day), but never have seen that issue. The only time when I run into the not posting is when I type too long and the website decided to log me out in between, where it then jumps to the main page instead of posting my message.

        You’re not logged in right?
        I mean you just enter your name/email when you post.

        If not logged in; what kind of OS and browser are you using.
        I’d like to get to the bottom of this, even though you’re the only one who seems to run into this – I would hate to loose visitors/participants like yourself because of a glitch I have not seen myself.

        Reply

        hans

        • Nov 8, 2015 - 12:40 PM - BosseB Comment Link

          Now back and looking at the site.

          It seems like my posts have been registered but after a very long delay, which I did not understand before. It is really not good if one clicks Submit, the site starts rolling and then you are brought to the top of thus very high page. So you scroll down only to find… NOTHING.

          Maybe the post is shown a couple of minutes later, but then I will have gone elsewhere.

          My OS is Windows 7 X64 Professional and I use Firefox with the latest updates applied.

          Reply

          BosseB

  • Nov 8, 2015 - 9:43 AM - BosseB Comment Link

    I’m back with a different problem:

    It seems like using the trunk versions of FPC and Lazarus while not being part of the development community for fpc and lazarus is not recommended. One can be hit with various problems caused by recent code changes.

    So I wanted to switch to using the latest release of fpc (2.6.4) together with the latest release of Lazarus (1.4.4).

    But I did not want to go through the big hurdle of starting from scratch on a new SDcard…

    So I set out like this:

    1) I still have the 2.6.4 version of the fpc compiler on my system so I changed back the symlink to point to it:

    sudo ln -sf /usr/local/lib/fpc/2.6.4/ppcarm /usr/local/bin/ppcarm

    2) Then I created a home for Lazarus in the pi home dir and downloaded the Lazarus release sources there (time as a leading command word makes it possible to see how long the process took):

    cd /home/pi
    mkdir lazarus
    cd lazarus
    time svn co http://svn.freepascal.org/svn/lazarus/tags/lazarus_1_4_4 1.4.4
    cd 1.4.4

    3) Then I tried to build the Lazarus IDE:

    time make bigide

    Unfortunately this ended after 2m27s with these errors:

    /usr/bin/ld: warning: ./link.res contains output sections; did you forget -T?
    /usr/local/lib/fpc/2.6.4/units/arm-linux/rtl/cprt0.o: In function `_haltproc_eabi':
    (.text+0x88): undefined reference to `_fini'
    /usr/local/lib/fpc/2.6.4/units/arm-linux/rtl/cprt0.o: In function `_haltproc_eabi':
    (.text+0x90): undefined reference to `_init'
    svn2revisioninc.pas(768) Error: Error while linking
    svn2revisioninc.pas(768) Fatal: There were 1 errors compiling module, stopping
    Fatal: Compilation aborted
    Makefile:2740: recipe for target 'svn2revisioninc' failed
    make[2]: *** [svn2revisioninc] Error 1
    make[2]: Leaving directory '/home/pi/lazarus/1.4.4/tools'
    Makefile:3155: recipe for target 'all' failed
    make[1]: *** [all] Error 2
    make[1]: Leaving directory '/home/pi/lazarus/1.4.4/tools'
    Makefile:3080: recipe for target 'lazbuild' failed
    make: *** [lazbuild] Error 2

    real    2m27.851s
    user    2m11.530s
    sys     0m13.090s

    So this is where I am now when trying to get release versions to work on my Pi2 with Raspbian Jessie.

    Any idea why it fails? (I have posted the question on the Lazarus mail list too)

    Reply

    BosseB

    • Nov 8, 2015 - 11:05 AM - hans - Author: Comment Link

      I’m not an expert, but it seems that you’re running into a linking problem.

      Did you try “make clean”?
      If I understand it correctly, it tosses all binaries of previously compiled units, forcing the compiler to recompile them, hopefully in the right version.

      Reply

      hans

      • Nov 8, 2015 - 12:45 PM - BosseB Comment Link

        Well, there should not have been any old binaries in this case because I am building bigide in a directory tha is freshly checked out with svn, hence it does not contain any binaries at all.

        But I just did a make clean followed by make bigide. Same errors

        BTW, I replied to you a couple of minutes ago and my post did not appear. I was thrown to the top of this page and after waiting for several minutes I scrolled down and there was nothing to be seen of my post. So maybe it will appear later tonight along with this…

        I did a

        Reply

        BosseB

      • Nov 9, 2015 - 3:24 AM - hans - Author: Comment Link

        Could it be that the compiler is pointing to the wrong sources?
        I’ve had similar issues when trying to compile a newer version for my Mac – it kept picking the wrong sources or wrong compiler.

        As for the issue with submitting a comment (which is embarrassing and a pain): I have submitted a support ticket with my webhost – see what they can find. I’ve tried Windows 10 with the latest FireFox and cannot reproduce the issue … I’ll also setup a virtual machine with Windows 7 and try it on that as well.

        Thanks for hanging in there …

        Reply

        hans

    • Jan 3, 2016 - 11:02 PM - Jim Kueneman Comment Link

      Did you figure this out?  I have gotten to the exact same place….

      Jim

      Reply

      Jim Kueneman

      • Jan 4, 2016 - 8:12 AM - hans - Author: Comment Link

        Hi Jim,

        I haven’t been able to test anything – I’ve been traveling the past weeks.
        As soon as I get back home (end of this week), I’ll give it a try and see … 

        Reply

        hans

    • Jan 3, 2016 - 11:26 PM - Jim Kueneman Comment Link

      Look here:

      https://blogs.oracle.com/jtc/entry/is_it_armhf_or_armel

      also googling around states that FPC was NOT compatible with ARMHF until 3.0 and Jessie is ARMHF while per the blog Wheezy was ARMEL

      By running the 2.6.4 distribution from the released SVN I bet the HF support was not added yet.  In the current Trunk it was likely added somewhere along the way and is official for 3.0

      Jim

      Reply

      Jim Kueneman

  • Nov 14, 2015 - 6:29 PM - DonB Comment Link

    Do you know of a way to communicate serially using the Raspberry Pi 2 GPIO serial UART from Lazarus?  I have read that TLazSerial does not work on RPI2.  Is there some other package for Lazarus that can do it?

    Thanks.

    Reply

    DonB

    • Nov 15, 2015 - 2:41 AM - hans - Author: Comment Link

      Hi DonB,

      Oh, I did not know that.
      I am unfortunately not aware of an alternative either, mostly because I’ve never used TLazSerial.

      Do you know why TLazSerial is not working with RPI2?

      Not sure how helpful it is, since it’s from 2014, but I did find this rather extensive post at the Lazarus Forum. I do not believe it’s RPI2 specific, but it deals with some compile issues that might be helpful to get it going on the RPI2 as well.

      Reply

      hans

      • Nov 15, 2015 - 6:30 AM - BosseB Comment Link

        That link is not working! It leads to homeservers where you are asked to buy their product. No sign of any Lazarus related stuff.

        In fact it is not even a complete URL:

        http://homeservers/

        Please edit the post and make the URL work or remove the potential security hole.

        Reply

        BosseB

      • Nov 15, 2015 - 6:32 AM - hans - Author: Comment Link

        My bad – I goofed up I suppose.

        I corrected the link. Lesson learned: do not write replies until you’ve finished your first coffee 

        I’ll place the link here again as well: link.

        Reply

        hans

  • Nov 30, 2015 - 10:06 PM - Zeng Jinsong Comment Link

    Very Excellent Article!  Thanks a lot!.

    When I execute the step ” Compile the latest FPC version”

    root@raspberrypi:/usr/local/fpc/source# make all OPT=-dFPC_ARMHF

    After several pages of text fly up, I got these error messages below and compiling process stopped:

    types.pp(667) Fatal: There were 1 errors compiling module, stopping

    Fatal: Compilation aborted

    Makefile:3702: recipe for target 'types.ppu' failed

    make[7]: *** [types.ppu] Error 1

    make[7]: Leaving directory '/usr/local/fpc/source/rtl/linux'

    Makefile:1983: recipe for target 'linux_all' failed

    make[6]: *** [linux_all] Error 2

    make[6]: Leaving directory '/usr/local/fpc/source/rtl'

    Makefile:4231: recipe for target 'rtl' failed

    make[5]: *** [rtl] Error 2

    make[5]: Leaving directory '/usr/local/fpc/source/compiler'

    Makefile:4120: recipe for target 'next' failed

    make[4]: *** [next] Error 2

    make[4]: Leaving directory '/usr/local/fpc/source/compiler'

    Makefile:4125: recipe for target 'ppc1' failed

    make[3]: *** [ppc1] Error 2

    make[3]: Leaving directory '/usr/local/fpc/source/compiler'

    Makefile:4137: recipe for target 'cycle' failed

    make[2]: *** [cycle] Error 2

    make[2]: Leaving directory '/usr/local/fpc/source/compiler'

    Makefile:2863: recipe for target 'compiler_cycle' failed

    make[1]: *** [compiler_cycle] Error 2

    make[1]: Leaving directory '/usr/local/fpc/source'

    Makefile:2895: recipe for target 'build-stamp.arm-linux' failed

    make: *** [build-stamp.arm-linux] Error 2

    What is the trouble ?  Thanks very much!

    Reply

    Zeng Jinsong

    • Dec 1, 2015 - 5:39 PM - hans - Author: Comment Link

      Thanks Zeng!

      Well, I looked through the messages and can’t really determine what the problem might be.
      I’d recommend starting the process from scratch again – I know that’s probably not the “pro” solution, but I have found myself doing just that once or twice in the past. 

      Reply

      hans

      • Dec 1, 2015 - 7:07 PM - Zeng Jinsong Comment Link

        Thanks hans!

        I’ll try the process with a new SD card again, if got some results, I’ll report them here. :P

        Reply

        Zeng Jinsong

        • Dec 3, 2015 - 9:47 AM - john Comment Link

          Zeng – I am getting exactly the same errors as you, did you resolve the issue ?

          Reply

          john

      • Dec 3, 2015 - 9:59 AM - hans - Author: Comment Link

        Unfortunately I’m traveling for the next few weeks, so I’m unable to test this myself.
        Maybe it’s an issue in the latest FPC version (from SVN)?

        Something goes wrong in “types.pp”, line 667. The following output is most likely caused by that error.
        Is there something before that, which might state something more useful why “types.pp” is failing?

        types.pp(667) Fatal: There were 1 errors compiling module, stopping
        Reply

        hans

    • Dec 2, 2015 - 1:01 AM - BosseB Comment Link

      If you used an 8 GB SDcard as the description here says and also used the latest RaspBian from the download site then chances are very high that you have run out of disk space!

      I did that mistake myself. You need at least a 16 GB card because the latest RaspBian is based on Debian Jessie and has a lot more stuff included than the older RaspBian based on Dabian Wheezy.

      Also the procedure described at the beginning is slightly different since RaspBian Jessie boots directly to the GUI after startup. To reach the configuration screen you have to start it manually. The GUI consumes a lot more RAM when running.

      Reply

      BosseB

      • Dec 6, 2015 - 2:04 AM - eapperley Comment Link

        I have exactly the same issue as other forum members with the fatal error connected to the file “types.pp”, etc.

        I have read through quite a number of 2015 installation articles on the web have:

        – the latest Raspian Jessie image

        – a 16GB card (I have expanded the distribution to fit the entire space of the 16GB SDCard)

        – a 1GB swap file

        – deleted all unnecessary applications such as games, Libre Office etc

        – booted directly to the CLI (not the GUI)

        – tried the procedure at least twice, but it always generates a fatal error message when compiling after the subversion trunk step (in response to the command ” make all OPT=-dFPC_ARMHF”).

        I’m at the end of the road at present.  Any suggestions?

        Reply

        eapperley

      • Dec 6, 2015 - 10:10 AM - hans - Author: Comment Link

        Hi Eapperley!

        Seems to have become a common problem, so I’m beginning to suspect that this might be a bug in the subversion code we pull down. I’m unfortunately nowhere near my stuff (traveling), so it might be an idea to get a SVN version of FPC, one version before the one SVN pulls as a default. Not quite sure how that works though – maybe someone has a suggestion?

        I have no ability to test any of this [at this time], but maybe this link might be helpful?
        So we can go 1 or 2 revisions back …

        Reply

        hans

      • Dec 6, 2015 - 10:24 AM - hans - Author: Comment Link

        I have not tested this, but after some looking around I found this:

        Checkout a working copy in REV revision (where REV seems to be the revision number you’d like to grab):

        svn checkout --revision REV http://svn.freepascal.org/svn/fpc/trunk

        Update your local working copy to REV revision:

        svn update --revision REV

        The current trunk version seems to be 32601.

        Or maybe we could try this approach (untested, early in the morning, etc):

        cd /usr/local/fpc
        svn co http://svn.freepascal.org/svn/fpc/tags/release_3_0_0 source
        cd source

        (not sure if this will work though – I’m not the most experienced SVN user)

        Reply

        hans

        • Dec 7, 2015 - 1:39 PM - Eric Comment Link

          Yes, this works fine.

          I’ll try to find time to check the procedure with a slightly newer version.

          Reply

          Eric

        • Dec 8, 2015 - 8:50 AM - hans - Author: Comment Link

          Hi Eric!

          Good to hear that!  

          Would you mind posting the latest version that does work?
          And maybe post the SVN statement …? I’m traveling so I’m unable to test it myself 

          Reply

          hans

    • Dec 2, 2015 - 8:19 AM - hans - Author: Comment Link

      For some reason I had not updated the article yet to reflect the need for a 16Gb SD Card – thanks for the reminder BosseB, I just updated the article! 

      Reply

      hans

  • Dec 7, 2015 - 1:07 PM - keno Comment Link

    Hi Good day! 

    It’s my nth time trying to have latest version of lazarus though i have older lazarus on my RPI. the error message goes like this.

    TRectF.Union(const TRectF):<record type>;”

    types.pp(667) Fatal: There were 1 errors compiling module, stopping

    Fatal: Compilation aborted

    Makefile:3711: recipe for target ‘types.ppu’ failed

    make[7]: *** [types.ppu] Error 1

    make[7]: Leaving directory ‘/usr/local/fpc1/source/rtl/linux’

    Makefile:1983: recipe for target ‘linux_all’ failed

    make[6]: *** [linux_all] Error 2

    make[6]: Leaving directory ‘/usr/local/fpc1/source/rtl’

    Makefile:4231: recipe for target ‘rtl’ failed

    make[5]: *** [rtl] Error 2

    make[5]: Leaving directory ‘/usr/local/fpc1/source/compiler’

    Makefile:4120: recipe for target ‘next’ failed

    make[4]: *** [next] Error 2

    make[4]: Leaving directory ‘/usr/local/fpc1/source/compiler’

    Makefile:4125: recipe for target ‘ppc1’ failed

    make[3]: *** [ppc1] Error 2

    make[3]: Leaving directory ‘/usr/local/fpc1/source/compiler’

    Makefile:4137: recipe for target ‘cycle’ failed

    make[2]: *** [cycle] Error 2

    make[2]: Leaving directory ‘/usr/local/fpc1/source/compiler’

    Makefile:2863: recipe for target ‘compiler_cycle’ failed

    make[1]: *** [compiler_cycle] Error 2

    make[1]: Leaving directory ‘/usr/local/fpc1/source’

    Makefile:2895: recipe for target ‘build-stamp.arm-linux’ failed

    make: *** [build-stamp.arm-linux] Error 2

    Please help me :(

    Reply

    keno

    • Dec 8, 2015 - 8:49 AM - hans - Author: Comment Link

      Hi Keno,

      this might be a bug in the SVN version, others have ran into a similar problem with the latest version.
      Check out this comment (click the link or scroll up a bit).

      Reply

      hans

  • Dec 14, 2015 - 10:48 AM - Vermos Comment Link

    Hi.

    Thank you for very good quide. I installed Lazarus succesfully to my Raspberry Pi 2. FPC version is 3.0.0 because SVN problems.

    I have a question. I need MySQL database. How can I install MySQL 5 database component into Lazarus IDE?

    BR:Vermos

    Reply

    Vermos

    • Dec 14, 2015 - 11:09 AM - hans - Author: Comment Link

      Thank you Vermos! 

      I have not tested this, and unfortunately I’m traveling so I don’t have my RPI with me:

      Lazarus Pascal standard comes with the SQLDB components, there you’ll find MySQL support. You’ll find more info in the Lazarus Pascal Wiki page related to this topic.

      DevArt offers MyDAC, which is commercial, and I did not test this one on a RPI either, but it definitely is one of my favorites. The Lazarus Wiki mentions that MyDAC is free for Lazarus but I could not find that particular free version and I’m not sure if they only offer the pre-compiled components (probably only suitable for Windows?) or actually the complete source code so you could recompile on your RPI.

      There is also the ZEOS component package, which is free and appears open source (SourceForge).

      If it were me, I’d test the SQLDB components first. If that doesn’t work [to your satisfaction], consider trying the ZEOS components.

      MyDAC is absolutely the best (under Windows anyway), but it’s commercial and not cheap.

      Hope this helps … 

      Reply

      hans

      • Dec 14, 2015 - 10:28 PM - Vermos Comment Link

        Hi.

        Thank you for your answer.

        I have not SQLDB tab in my Lazarus toolabar. I wonder is something went wrong in installing phase? I installed FPC version 3.0.0.

        BR:Vermos

        Reply

        Vermos

        • Dec 15, 2015 - 2:15 AM - BosseB Comment Link

          The SQLDb tab sits in my Lazarus 1.5 (built from trunk rev 50059M) 7 tabs to the right of the tab “Data Access”.

          It contains many connection components for various databases, like MSSql, Sybase, PQ, Oracle, ODBC, 6 different MySql versions, SQLite3, IB and FB.

          How did you build Lazarus? Did you build using “make bigide” or what? That is what I did in any case.

          I am just in the process of switching to the FPC release 3.0.0 and Lazarus 1.6RC1….

          Reply

          BosseB

          • Dec 15, 2015 - 10:14 AM - Vermos Comment Link

            Hei.

            I follow your instructions (Step 5 – Install the Lazarus Pascal IDE).

            Is it possible that something went wrong in step “Getting some additional Packages” ?

            BR:Vermos

            Vermos

          • Dec 15, 2015 - 1:38 PM - hans - Author: Comment Link

            Hi Vermos,

            Well, I’d assume you would have seen a bunch of error messages.
            I’m not near any RPI, but when I look at Lazarus on my Mac, there is a small arrow pointing to the right, on the very far right of the component tool bar. This allows you to scroll through the different component groups. Even on my Mac I have to scroll 

            hans

          • Dec 18, 2015 - 10:44 AM - Vermos Comment Link

            Hi.

            After installing I have 9 tabs in my Lazarus. I don’t have “SQLdb” tab after “Data Access” tab. The next tab after “Data Access” is “System” tab. I also try to use Debian Wheezy. But the result is the same than Jessie.

            I hope that some day the old Lazarus install will be work again. Just a few commands and everything works. :)

            BR:Vermos

            Vermos

          • Dec 18, 2015 - 10:54 AM - hans - Author: Comment Link

            Hi Vermos,

            I can’t verify this for the RPI at this time (traveling), but on my Mac, the SQLDb tab is one of the last tabs in the component window. Even with full-screen I need to scroll using the little-tiny-well-hidden arrow …
            On my component window “System” indeed follows “Data Access”.
            “SQLDb” appears after “RTTI” (not sure if that one exists on the RPI – I have never used it).

            I apologize if this sounds repetitive, and is what you already looked at, just wanted to make sure … 

            Lazarus Component window - The arrow to scroll component groups

            Lazarus Component window - showing SQLDb

            hans

          • Dec 18, 2015 - 11:18 AM - BosseB Comment Link

            I have not done anything special except make bigide and I have the following tabs in my Lazarus:

            Standard
            Additional
            Common Controls
            Dialogs
            Data Controls
            Data Access
            System
            Misc
            LazControls
            Pascal Script
            INet
            RTTI
            SQLdb
            SynEdit
            Chart
            IPro

            This is on a RPi2 Raspbian Jessie where I installed Lazarus from svn trunk back in October-November.

            BosseB

          • Dec 18, 2015 - 11:19 AM - hans - Author: Comment Link

            Thanks BosseB for confirming! 

            hans

        • Dec 18, 2015 - 11:22 AM - BosseB Comment Link

          And I had a look in Lazarus 1.2.4 which I also installed in the RPi2.

          The SQLdb tab is still there but even further to the right, almost at the end.

          Reply

          BosseB

          • Dec 21, 2015 - 11:46 AM - Vermos Comment Link

            Hi.

            I double checked but I have not SQLdb tab. But I installed this from component library and now it seems to be working fine. I don’t know why this component are not installed automatically.

            Vermos

  • Dec 19, 2015 - 7:30 AM - BosseB Comment Link

    FPC 3.0.0 and Lazarus 1.6RC1?

    I have tried to install the latest fpc 3.0 release and the release candidate for Lazarus 1.6, but it was not possible to complete.
    I wonder if someone has succeeded in doing it? I have done the exercise on an RPi2 with Raspbian Jessie where I earlier installed according to the description above (with modifications for user vs superuser).

    I basically used the method described here but checked out fpc release 3.0.0 and lazarus 1.6 RC1 via svn.
    FPC 3.0.0 was compiled using the bootstrap compiler 2.6.4 as described here and then I tried to make bigide in the lazarus sources.

    But it fails almost immediately with an error message:

    (9009) Assembling lazaruspackageintf
    /home/pi/development/src/lazarus/1.6.RC1/packager/registration/registerfcl.pas(45,22)
    Fatal: (10022) Can't find unit process used by RegisterFCL
    Fatal: (1018) Compilation aborted

    Is there anyone that can explain this? I have asked at the lazarus mail list but get only unhelpful replies.
    I even tried setting the syl´mlink for fpc back to the 2.6.4 version but get the same error.

    Reply

    BosseB

    • Dec 19, 2015 - 12:42 PM - BosseB Comment Link

      It turned out that I received a reply on the lazaus mail list and it guided me to a working procedure.
      Here is how I did it in a Pi2 which had alredy older versions of fpc and lazarus running so all required extra stuff was already installed:

      1) Build the FreePascal release 3.0 compiler
      ————————————————————
      Download latest FPC sources:

      cd ~/dev/src/fpc
      svn co http://svn.freepascal.org/svn/fpc/tags/release_3_0_0 3.0.0

      Compile the FPC release compiler (using the bootstrap 2.6.4 fpc compiler):

      cd 3.0.0
      make all OPT=-dFPC_ARMHF
      sudo make install OPT=-dFPC_ARMHF PREFIX=/usr  <==Notice the use of /usr!

      Make the new version globally active by moving the symbolic link for ppcarm:

      ln -sf /usr/lib/fpc/3.0.0/ppcarm /usr/local/bin/ppcarm

      2) Build the Lazarus IDE release candidate 1.6RC1
      ———————————————————————
      Download sources:

      cd ~/dev/src/lazarus
      svn co http://svn.freepascal.org/svn/lazarus/tags/lazarus_1_6_RC1 1.6RC1

      Compile Lazarus IDE 1.6RC1:

      cd 1.6RC1
      make bigide
      strip -s lazarus  (reduces the size of the binary)

      Now one just have to create a new profile directory for this lazarus and then add it to the Jessie Main Menu.

      cd ~
      mkdir .lazarus_1.6RC1

      In the start menu item for lazarus 1.6RC1 one must enter the command as:

      /home/pi/dev/lazarus/1.6RC1/startlazarus --pcp=/home/pi/.lazarus_1.6RC1 %f

      Then on first start of lazarus one has to enter the location of the fpc compiler and the fpc sources.

      Lazarus now runs fine.

      Note that the sources have been all collected into the /home/pi folder tree and sudo is only used when doing make install for fpc and thereafter creating the symlink that puts it on path on the system.

      PS:
      Is there a way to have this comment tool NOT make double spaced lines?
      It is extremely irritating that it shows code lines in separate code sections with whitespace inbetween  when I select a block of code and hit the code formatting button.
      And when typing normal text it does the same, every time I hit Enter it creates an extra empty line space between the previous and the new line. I have always to remember to hold down the shift key when I hit Enter to get to the next line without the extra wasted space…
      And that does not work for the code lines, which I have to backspace out and then use Shift-Enter to get a decent format.
      DS

      Reply

      BosseB

      • Dec 20, 2015 - 9:25 AM - hans - Author: Comment Link

        Thanks BosseB!

        Excellent info! I’ll get started with that right away when I get back from my trip (somewhere in January). 

        As for the comment editor. Yeah it’s not always working as smooth as I’d like to see it. Unfortunately, there are not many “good” rich text editors for WordPress, except for tinyMCE, which a pita to get running properly and it’s relatively huge to load. But I’ll look into that one again. This editor actually does everything HTML style, so pressing ENTER = a hard line break, and shift+ENTER = soft line break.

        I’ll make it priority to get a better editor … sorry for the inconvenience. 

        Reply

        hans

        • Dec 22, 2015 - 4:01 PM - hans - Author: Comment Link

          I’m putzing with the Rich Text Editor … the WordPress default (tinyMCE) shows similar issues.
          I’ll keep working on it …. 

          Reply

          hans

      • Dec 21, 2015 - 1:42 AM - ian Comment Link

        I tried this after trying what was in the main article, but it didn’t work either. I started with a clean SD again, but no luck.

        When I run bigide it fails ie

        root@raspberrypi:/usr/local/src/lazarus/1.6RC1# make bigide
        make -C packager/registration
        make[1]: Entering directory '/usr/local/src/lazarus/1.6RC1/packager/registration'
        /bin/rm -f ../units/arm-linux/fcllaz.ppu
        /usr/local/bin/ppcarm -MObjFPC -Scghi -O1 -g -gl -l -vewnhibq -Fu. -Fu/usr/lib/fpc/3.0.0/units/arm-linux/rtl -FE. -FU../units/arm-linux -darm fcllaz.pas
        Hint: (11030) Start of reading config file /etc/fpc.cfg
        Hint: (11031) End of reading config file /etc/fpc.cfg
        Free Pascal Compiler version 3.0.0 [2015/12/21] for arm
        Copyright (c) 1993-2015 by Florian Klaempfl and others
        (1002) Target OS: Linux for ARMHF
        (3104) Compiling fcllaz.pas
        (3104) Compiling registerfcl.pas
        /usr/local/src/lazarus/1.6RC1/packager/registration/registerfcl.pas(45,22) Fatal: (10022) Can't find unit process used by RegisterFCL
        Fatal: (1018) Compilation aborted
        Makefile:2702: recipe for target 'fcllaz.ppu' failed
        make[1]: *** [fcllaz.ppu] Error 1
        make[1]: Leaving directory '/usr/local/src/lazarus/1.6RC1/packager/registration'
        Makefile:3050: recipe for target 'registration' failed
        make: *** [registration] Error 2
        root@raspberrypi:/usr/local/src/lazarus/1.6RC1#

        The fpc 3.0.0 install seems to be fine, ie

        root@raspberrypi:/usr/local/src/lazarus/1.6RC1# fpc
        Free Pascal Compiler version 3.0.0 [2015/12/21] for arm
        Copyright (c) 1993-2015 by Florian Klaempfl and others
        /usr/lib/fpc/3.0.0/ppcarm [options] <inputfile> [options]

        Any ideas? I really want to get lazarus installed on my pi!

        Reply

        ian

        • Dec 21, 2015 - 9:34 AM - BosseB Comment Link

          Obviously you have the exact same error message as I had. So the advice I received from one of the developers of Lazarus should apply to you too.
          Did you try the steps I outlined above? They solved the problem for me at least. Notice specifically the use of these fpc 3.0.0 compile commands which were all executed as user pi (hence sudo in some places):

          make all OPT=-dFPC_ARMHF
          ## NOTE: Use the PREFIX=/usr below
          sudo make install OPT=-dFPC_ARMHF PREFIX=/usr
          ## Move the symlink to point towards the new fpc 3.0.0
          sudo ln -sf /usr/lib/fpc/3.0.0/ppcarm /usr/local/bin/ppcarm
          ## Now deal with Lazarus...
          Reply

          BosseB

          • Dec 21, 2015 - 4:11 PM - ian Comment Link

            Yep, I’d followed your instructions exactly (given I’d had the same problem with the original article..)  So I’m wondering if it worked for you because you had an older version floating around…

            Did it twice – we a clean sd card install in the middle – just to make sure, but it still didn’t work…

            ian

          • Dec 21, 2015 - 4:56 PM - BosseB Comment Link

            Yes, my RPi 2 was not pristine. I had already 2 working fpc versions (2.6.4 bootsrtap and 3.1.1 from trunk as described earlier). Same for lazarus, I had the old release 1.2.4 and trunk which is 1.5.

            So if there is something else that is also needed it might lurk in the background…

            I don’t have time to make a pristine RPi2 Jessie and do it from scratch right now, maybe after the holidays in beginning of next year…

            BosseB

          • Dec 21, 2015 - 7:40 PM - ian Comment Link

            I’ll try the older version of lazarus and see what happens…

            ian

          • Jan 9, 2017 - 7:58 AM - Dylan Comment Link

            Did you ever come right? I’m stuck with the same problem…

            Dylan

  • Dec 22, 2015 - 4:30 AM - ian Comment Link

    I tired 1.4r1 and 1.2r1 and had the same problem with both as 1.6

    Reply

    ian

    • Dec 22, 2015 - 6:52 PM - ian Comment Link

      I tried this process http://otapi.com/2015/02/10/raspberry-pi-2-freepascal-lazarus-and-delphi/ and it all worked fine.

      The only thing I had a slight problem with was lazarus wasn’t on the menu when I finished. I think it may have been because the ide wasn’t running when I did the install, so I turned on the ide, rebooted, re did

      make all OPT=-dFPC_ARMHF
      make install OPT=-dFPC_ARMHF PREFIX=/usr/local

      and then everything was fine, and it was on the menu. Got in and did a quick program, everything fine!

      So what I should do is go through that process, and the one on this web site, and see what difference made it all work… :-)

      Reply

      ian

      • Dec 22, 2015 - 7:29 PM - ian Comment Link

        and of cause I meant GUI instead of ide above..

        Reply

        ian

      • Dec 23, 2015 - 2:14 AM - BosseB Comment Link

        I have noted the following items on that process that I feel are not really good:

        1) The operating system is old, should be Raspbian Jessie now and then an 8GB card will not nearly suffice. Must be at least 16 GB. And the swap should be set to 1000 rather than 500.

        2) There is no need to go through the hoops of partitioning the SDcard. The downloaded RaspBian Jessie image is already partitioned, just write it to the SDcard with Win32DiskImager and it is ready to go.

        3) The TightVNC server should NOT be configured to run as user root! It is generally not considered good practice to run a computer routinely as root. Only those operations that are needing root should be done as root (using sudo)

        4) For anyone that is not involved in developing FPC or Lazarus themselves it is also not advisable to check out trunk from svn. Much better to use a stable release versions, these are also available via svn so the only change needed for that is to go for another tag.

        5) I also think that the sources should be downloaded into the user pi home directory, for example /home/pi/dev/src/fpc/<rev number> and /home/pi/dev/src/lazarus/<rev number> respectively, and then built there.
        Then sudo make install will put them into the proper common locations if needed (note that lazarus and fpc can be perfectly well used from the home directory). An RPi is usually not a multi-user system in practice so there is no real need to provide for *all* users to run Lazarus…

        These are my views in any case….

        Reply

        BosseB

        • Dec 23, 2015 - 5:24 AM - ian Comment Link

          1) I agree, and I ignored the OS instruction and did have jessie, I also used a 32GB card, and 1200 for swap (just to make sure.. :-)

          2) I didn’t do that either

          3) I didn’t do the VNC at all either, SSH is fine, and my pi is plugged into a monitor anyway.

          So (1) (2) (3) couldn’t be why it worked when the one from here didn’t…

          4) I DID get trunk (both this page and that one said that), and it worked (could be for another reason) where 1.2, 1.4, and 1.6 (all R1) didn’t….

          5) I don’t think that would have made the difference…

          Now I’ve got it working I don’t want to touch it, but I should go through each step changing one thing at a time to see if I can figure out what made it work..

          Reply

          ian

        • Dec 23, 2015 - 10:01 AM - hans - Author: Comment Link

          I agree with BosseB that the article could use an update … 

          As soon as I get back home, I’ll try to make some time to write a new article, geared towards Jessie and including some of the comments and suggestions presented here by you guys! 

          Thanks again for the great input and sharing! 

          Reply

          hans

  • Dec 30, 2015 - 12:59 PM - Cyleen Cerrudo Comment Link

    Hi sirs! Regarding with the step 4 – downloading latest FPC sources, in this part

    svn co http://svn.freepascal.org/svn/fpc/trunk source    <—– After I enter this

    I always get a reply of “svn: E175002: unable to connect to a repository at URL ‘http://svn.freepascal.org/svn/fpc/trunk'” and ” svn: E175002: Unexpected HTTP status 400 ‘bad request’ on ‘/svn/fpc/trunk’ . How do we solved this? Please help us, we badly need this for our thesis. Thanks in advance! :)

    Reply

    Cyleen Cerrudo

    • Dec 31, 2015 - 9:02 AM - hans - Author: Comment Link

      Hi Cyleen,

      This could be an issue on your end – the link works just fine here.
      Could it be that your ISP, or a proxy, is blocking this? (not sure why they’d even do that)

      Can you click the link you’ve posted directly in your browser? (http://svn.freepascal.org/svn/fpc/trunk)
      When I do that, it just opens the correct page.

      Reply

      hans

      • Jan 1, 2016 - 8:00 AM - Cyleen Cerrudo Comment Link

        thanks for the reply sir! when I click that sir, it shows Parent Directory, compiler/, ide/, and etc. Is this correct sir? Also, how to prevent the proxy in blocking this sir? Thanks again :) 

        Reply

        Cyleen Cerrudo

      • Jan 1, 2016 - 11:37 AM - hans - Author: Comment Link

        Hi Cyleen,

        That sounds correct. So you do have access to the link in your regular browser, which means there is nothing blocking access to the SVN sources.
        Does your Raspberry Pi have a proper and stable network connection?

        You could also try the link in a browser on your Raspberry Pi – just to test if the connect works correctly.

        Reply

        hans

      • Jan 1, 2016 - 12:06 PM - Cyleen Cerrudo Comment Link

        hi again sir, i think the issue above has been solved. But now after the ‘make all OPT=-dFPC_ARMHF’, it doesn’t show a lot of messages as you said. I’d only get ‘make: *** No rule to make target ‘all’. Stop.’ What do you think the problem is sir? 

        Thanks in advance sir! :)

        Reply

        Cyleen Cerrudo

        • Jan 1, 2016 - 12:09 PM - hans - Author: Comment Link

          That message basically says that I doesn’t know what to do with ARMHF as a target (for the compiler).
          This is either because you made a typo, or because the Free Pascal compiler installation didn’t go as it was supposed to.

          Double check for typo’s, or use copy and paste …

          make all OPT=-dFPC_ARMHF
          make install OPT=-dFPC_ARMHF PREFIX=/usr/local
          make install sourceinstall OPT=-dFPC_ARMHF PREFIX=/usr/local
          Reply

          hans

          • Jan 1, 2016 - 2:12 PM - Cyleen Cerrudo Comment Link

            hello sir sorry to disturb you again, i started from scratch again and I also did copy paste but i still get the same message. 

            Cyleen Cerrudo

        • Jan 1, 2016 - 12:39 PM - Cyleen Cerrudo Comment Link

          I already change the swapfile to 1000 sir.

          Reply

          Cyleen Cerrudo

  • Jan 1, 2016 - 12:44 PM - Cyleen Cerrudo Comment Link

    i have a question sir, do i need to do the “sudo apt-get update” and etc. part? Or i can proceed to the steps? 

    Reply

    Cyleen Cerrudo

    • Jan 2, 2016 - 8:38 AM - hans - Author: Comment Link

      Hi Cyleen,

      I’d start with a new and clean Wheesy image for your Raspberry Pi (or read the suggestions by BosseB etc on how to do this on Jessie), and start over.

      Reply

      hans

      • Jan 3, 2016 - 12:30 AM - Cyleen Comment Link

        Hi sir. We tried it in wheezy. So far it’s good. But in the part of ls /usr/local/lib/fpc it only shows 2.6.4 lexyacc. Is that okay? We still proceed on the steps, bu the lazarus didn’t shows up in the desktop. Thanks in advance :)

        Reply

        Cyleen

  • Jan 4, 2016 - 3:20 PM - Jim Kueneman Comment Link

    Ok I wrote a script that installs FPC 3.0.0 Release and Lazarus 1.6 RC1 on Jessie (full not LITE).   You can get it from the link in the instructions below.   Let me know how it goes.

    This procedure will NOT use the /usr/local folder as FPC 3.0.0 seems to look for a few things during the compile that assume it is in the /usr/fpc folder and not the /usr/local/fpc. This means I don’t know how this will coexist with any pre installed versions of FPC and Lazarus in the /usr/local folder. The scripts was conceived assuming a fresh version of Raspian Jessie 11/21/2015 or newer (it may work on older versions but this is the first version of Jessie I downloaded)

    1) Follow the instructions in Step 1 above to install Jessie on your 16G or larger SD card. After Step 1 follow these instructions and run the script as explained.   I have run it several times and it succeeded every time on fresh Jessie SD cards.

    2) Boot the RPi with a network connection, monitor, keyboard and mouse connected

    3) [Menu>Preferences>Raspberry Pi Configuration] and click “Expand File System”, click OK to the message

    4) Click OK for the Preferences dialog and Yes to Reboot

    5) Open the web browser and download the script file from, “http://www.mustangpeak.net/install_laz.sh“, and place it on the Desktop

    6) Changing the swapfile size is NOT necessary

    7) Open a terminal window from the Task Bar (yes this can all be done from within the GUI!

    8) Type “cd Desktop” in the terminal window

    9) Type “sudo sh install_laz.sh” in the terminal window and sit back with a cup of coffee and answer a few questions along the way

    10) Answer all questions during the legacy FPC install with the default choices (this is different than explained in the tutorial above)

    11) Follow the last few line printed to the terminal window to tell Lazarus where to find the FPC sources

    Reply

    Jim Kueneman

    • Jan 4, 2016 - 4:07 PM - hans - Author: Comment Link

      Thank you Jim for an awesome script! 

      Would you mind if I add a local download? (ie. download it from Tweaking4All.com as a backup?)

      Reply

      hans

      • Jan 4, 2016 - 4:26 PM - Jim Kueneman Comment Link

        Absolutely.  That is what it is for.

        Jim

        Reply

        Jim Kueneman

        • Jan 5, 2016 - 8:06 AM - hans - Author: Comment Link

          Thanks Jim!

          I’ll wait a little until BosseB’s input is merged with your script, and until I had the chance to test it.
          Thank you very much for all the effort! 

          Reply

          hans

    • Jan 4, 2016 - 4:47 PM - BosseB Comment Link

      Hi Jim!

      I had planned on writing a script like this myself once I had gotten all of the details ironed out. But now I don’t have to. :)

      Anyway I have a few comments:
      The script runs as su and installs both fpc and lazarus into the read-only (for user pi) location /usr
      But I found that when one uses Lazarus and installs some new packages it wants to rebuild Lazarus itself and this is a problem when I run Lazarus on a daily basis as user pi. All advice I have read about Lazarus is to place it below the pi home dir because then it will be writeable for user pi.

      So I will modify the script to place Lazarus into /home/pi/dev/lazarus and test it that way on a new Jessie.

      Concerning Jessie I will download the new image as you alerted me that there is a newer version available now. I have done my tests with the 2015-09-24 version, but my image currently is probably messed up due to the many tests I have done so a new fresh image is really needed  anyway. I would have done it today if I had gotten the time, lucky I didn’t so I had time to see your script post! :)

      Thanks for posting it!

      Reply

      BosseB

      • Jan 4, 2016 - 5:03 PM - Jim Kueneman Comment Link

        Yes, I am not a Linux/UNIX expert by any means.  I was hoping this would be the start of a community effort to fix issues like this.   I was just trying to “make it work”.  Since it takes a good hour to execute the entire script on my DSL many tests take too much time.   In Wheezy, and how Hans describes it above, I have my custom component set I compile into Lazarus all the time with Lazarus installed in /user/local/lazarus.  I alway run as the normal “pi” user all the time as well.  

        I have not tried the component set it with Jessie and this install yet though.

        Jim

        Reply

        Jim Kueneman

      • Jan 4, 2016 - 6:19 PM - Jim Kueneman Comment Link

        I just synced up my component repository and installed the components into Lazarus.  The IDE recompiled fine under /usr/Lazarus while logged in as the Pi user.  I don’t know…..

        Jim

        Reply

        Jim Kueneman

      • Jan 5, 2016 - 2:41 AM - BosseB Comment Link

        I am preparing my attempt at using a modified script which uses sudo internally when needed so the script itself can be executed by pi.

        But since I did not know how shell-scripts really work I made a test script just to test if one could use sudo inside a script:

        echo Creating directory testing as pi
        mkdir testing
        cd testing
        ls -la
        echo Creating directory sutest as root
        sudo mkdir sutest
        echo Trying to enter sutest as pi
        cd sutest
        ls -la
        pwd
        echo press Enter to quit
        read junk
        echo Done!

        What happened when I ran this is that it proved that it is possible to switch to root using su for specific commands.
        The directory sutest is owned by root as was the goal.
        So I will use this approach when I modify your script.

        Now I will just have to save the work I have done in the current image to somewhere I can access it when the new image is running the Pi…

        Reply

        BosseB

      • Jan 5, 2016 - 7:56 AM - hans - Author: Comment Link

        Awesome guys!

        You are doing all the work and by the time I get back home from my trip it will be all ready haha.  Just kidding 
        Please share the script when done … I’ll look at it by the end of this week. 

        Reply

        hans

    • Jan 6, 2016 - 5:31 AM - BosseB Comment Link

      I have made a first test using my slightly modified script in a brand new Raspbian Jessie (latest image). I did not even install tightvnc, instead I have a monitor and keyboard/mouse connected to see the desktop.

      The script ran for quite a while but it finished with errors.
      But the errors were hard to see because the script chugged along even if a command ended erroneously, so I will have to add error checking into it.

      One error was surely caused by lack of swap, so step 6 saying swap could be left as-is seems not to be right. I could not compile manually either until I increased swap to 1000. Then I could manually run each command in the script file to a successful end.

      In some places there is supposed to be user interaction (hit enter on questions) but no questions appeared it when running in the script, it just continued running. Has to be investigated.

      So I will add error checking after each command and I will look for the missing stops for user input.

      Reply

      BosseB

      • Jan 6, 2016 - 5:37 AM - Jim Kueneman Comment Link

        Yes it does need error checking.  The swap is very odd.  I have built at least 6 SD cards without touching the swap size including one last night using the ARMV6 switches.

        Jim

        Reply

        Jim Kueneman

      • Jan 6, 2016 - 12:34 PM - BosseB Comment Link

        I cannot definitely say that it is swap, but when the script had run and there was no fpc installed (no symlink in any case) I tried running the command to compile fpc manually and again it failed after a while. Since I recognized the behaviour I had a look at swap and it was set to 100. So I changed to 1000, rebooted and repeated the manual build, which now succeeded.

        One item I am struggling with is the fact that the user interaction seems to be missing. Only at the points where there is a command:
        read junk
        in the script itself will it stop.
        But when for instance the 2.6.4 installation script is executed there are user entry stops when manually run but not via the script.

        Is there some setting somewhere that tells the script to forward “internal” user input requests to the real user?

        It might be this problem that made the run fail.
        Note that I am trying to run the script as user pi by including sudo inside the script wherever needed.

        I have never written shell scripts for Linux before so I might have done some error here. Of course lacking error checking makes the process just run on even when a vital part has failed…

        I got some info on error trapping in scripts here so I have tried to include these procedures inside the script.

        Next problem is how to reset to a known starting point where there are no traces of the tests done so far. Probably need to wipe the SD-card with a fresh image and start over from scratch….

        Reply

        BosseB

      • Jan 6, 2016 - 6:21 PM - BosseB Comment Link

        I was wrong about the user input prompts! Failed memory…
        They appear all right!

        I have now checked the script with my modifications on a brand new Raspbian Jessie SD-card (32 GB) with swap set to 1000.
        During this test the script had a number of stop points so I could check the state of things along the way.

        All went fine and Lazarus 1.6RC1 appears on the start menu as intended. My error traps are there but were not activated this time around. No errors occurred.

        I will now clean up the script and then publish it.
        I will relocate stuff so that all apt-get commands are collected together as well as the file downloads before the real action is started.

        Reply

        BosseB

      • Jan 7, 2016 - 4:45 AM - BosseB Comment Link

        Now I have tested the script and restructured it so that it can be easily adapted to install other versions in the future.

        It installs FPC as root into /usr just like the original script does, but Lazarus will be installed by user pi in /home/pi/dev/lazarus and a menu entry is set up for that location.

        The script now contains error checking for virtually all commands executed inside and it will abort when an error is detected while showing which line number the error was detected on.

        Furthermore I have collected the commands into groups:
        – Start by doing all system updates via apt-get
        – Then download all of the files needed for the install (seed compiler, fpc sources, lazarus sources)
        – Next install the seed compiler and then build and install fpc 3.0.0 as root
        – Now build the Lazarus bigide
        – Finally create the Lazarus entry for the Jessie start menu

        The modified script is available online here. I changed its name to install_laz_pi.sh.

        Notice that in my experience the swap should be increased to 1000 as follows before running the script:

        sudo nano /etc/dphys-swapfile
        change as follows:
        CONF_SWAPSIZE=1000

        Then reboot the Pi

        Reply

        BosseB

        • Jan 7, 2016 - 5:40 PM - Chris Comment Link

          Fantastic job BosseB!  Can’t wait to try it out.

          Reply

          Chris

        • Jan 7, 2016 - 11:03 PM - Jim Kueneman Comment Link

          Hi,

          Great work!  I did not need to change the swap size.  I have also updated it to ask a question to compile for the ARMv6 (All Pi Models) or ARMv7 (Pi 2 only).  

          http://www.mustangpeak.net/install_laz_pi.sh

          Jim

          Reply

          Jim Kueneman

          • Jan 8, 2016 - 1:34 AM - BosseB Comment Link

            Jim,

            I wonder how you have set up the Pi2 while installing via the script?
            Did you disable booting into the GUI by any chance?

            In earlier versions of Jessie at least I tried to see if only booting to the command line made a difference, and it did. If the GUI was not started then the swap setting did not need as high a value. But if I did not change anything in Jessie regarding boot then it boots into the GUI and apparently that consumes a fair amount of memory, which makes a bigger swap size necessary. Anyway it could be tested again of course but the cycle is fairly long when starting from a new SD-card, so I think I don’t have the time anymore. With a fair size SD-card 1000 MB of swap is not all that bothersome either….
            But I guess I could change the swap and then just rebuild Lazarus (that is where the swap made a big difference before).

            make clean
            make bigide

            should be the two commands needed for this.

            BTW, the script I posted is not the same as I ran to completion! After I succeeded I rearranged the commands to collect all downloads in one place before starting installing and building, and this was not tested…
            So there might be a typo somewhere even though I was careful when I moved text around.

            BosseB

          • Jan 8, 2016 - 2:59 AM - BosseB Comment Link

            I went ahead and changed swap back to 100, rebooted and executed:

            make clean
            make bigide

            in the Lazarus source dir. The main build took 15m27s and succeeded.
            I could compile and run a “Hello World” program just fine.
            So it looks like if one uses a big SD-card (mine is 32 GB) and Raspbian Jessie from Nov 21, 2015 there is no need to increase swap.

            You were right! :)

            BosseB

          • Jan 8, 2016 - 7:14 AM - Jim Kueneman Comment Link

            BosseB,

            I just fired up the RPi2 into the GUI and ran your script.  It worked fine all the way to the end.   All I did was instead of using the first wait for “junk” I use it to type in ARMv6 or ARMv7 and compile to the different processor if wanted.

            Jim

            Jim Kueneman

    • Jan 6, 2016 - 7:54 AM - Stefan Hellwig Comment Link

      Jim, I have done the Lazarus installation using your script and it worked without any problems. I did have massive problems with all other procedures I could find but your script worked just fine for me. 

      Thank you very much.

      Stefan

      Reply

      Stefan Hellwig

  • Jan 11, 2016 - 4:20 AM - john Comment Link

    Just tried this, and all appeared to go well, but there is no “Lazarus” option under Menu->Programming.

    Downloaded script onto 32GB SD card with latest Jessie, changed access permissions to allow execution, then executed script by typing “./install_laz_pi.sh”

    Should I have prefixed that with “sudo” ?

    As I said the script appeared to run to completion, and it did create the “/home/pi/.local/share/applications/lazarus-test.desktop” file.

    Any thoughts on what I’ve done wrong ?

    Reply

    john

    • Jan 11, 2016 - 6:39 AM - BosseB Comment Link

      I just wrote a lengthy comment with instructions but when submitted it disappeared along with this page!

      Not good. :(

      Reply

      BosseB

    • Jan 11, 2016 - 6:42 AM - BosseB Comment Link

      And I tried it again with the same dismal result.

      Is there a limit to the length of a comment?
      Given an email address I could send the suggestions directly but this is really frustrating…

      Reply

      BosseB

      • Jan 11, 2016 - 10:19 AM - hans - Author: Comment Link

        1) No you should not use sudo. The purpose of my script changes was to make the script itself use sudo wherever needed and otherwise not.
        I wanted it to put the lazarus sources inside the pi home so they could be updated easily.

        2) The Jessie menu system is really frustrating…
        I have struggled a lot with it and finally I thought I found a working way to get the darned menu items onto the menu. The script makes a desktop file that should be used by the menu handler. It works for me but apparently not for you..

        What I can suggest is the following:
        – Open the file /home/pi/.local/share/applications/lazarus-test.desktop in nano so you see the commands inside it
        – Select the menu command: Preferences/MainMenuEditor
        – In the window that pops up select the “Programming” node
        – Then use the “New Item” button to bring up a dialog
        – Fill in Name and Comment as you like but copy the Exec command from the desktop file in to the Command field
        – Click the box in the upper left part of the dialog, this brings up the Icon setting. Copy the Icon item from the desktop file to here
        – Now hit OK and wait a while until all settles (takes upwards of 10s)

        At this point you should have a Programming menu item for Lazarus and quite possibly two (the one deposited may have been activated now).

        The menu handling is really shaky in Jessie in my opinion.

        By the way the actions above will have created a desktp file alacarte-made.desktop in the applications dir. Why it uses such a strange name is beyond me.

        Reply

        hans

    • Jan 11, 2016 - 6:58 AM - hans - Author: Comment Link

      Hi BosseB,

      my apologies for the posts that keep failing – it is very frustrating, and it seems a limitation of WordPress, or you had something in the comment that is being caught by mod_security of the Apache webserver …
      Feel free to email me the comment, and I’ll see if I can post it on your behalf (and maybe see why it fails).
      (webmaster at tweaking4all dot com).

      Reply

      hans

  • Feb 18, 2016 - 11:40 AM Comment Link
    PingBack: www.contrapositivediary.com

    […] on the Raspberry Pi for me. However, installation on the newer Raspberry Pi 2 is much trickier. This installation tutorial is almost a year old, and I haven’t yet installed Lazarus 1.4 or 1.6 on my Pi 2, but […]

  • Feb 19, 2016 - 3:13 PM - andyw Comment Link

    Please check this article: http://otapi.com/2015/02/10/raspberry-pi-2-freepascal-lazarus-and-delphi/

    No error whatsoever with the installation steps

    Reply

    andyw

    • Feb 20, 2016 - 4:10 AM - hans - Author: Comment Link

      Thanks for the link AndyW! 

      But that link is already listed under the “additional resources” below the article .
      It’s a very good article though! Thanks for highlighting it again, others might find this useful as well.

      Reply

      hans

    • Feb 20, 2016 - 4:46 AM - BosseB Comment Link

      Notice that FreePascal is now on release 3.0 and Lazarus 1.6 was released Feb 18, 2016 and uses the release version of FreePascal.

      So in order to get these onto the Raspbian Jessie system on an RPi2 the best way is to use Subversion to download the releaee sources into directories named after the version numbers:

      svn co http://svn.freepascal.org/svn/fpc/tags/release_3_0_0 fpc_3.0.0
      svn co http://svn.freepascal.org/svn/lazarus/tags/lazarus_1_6 lazarus_1.6

      In order to build fpc 3.0.0 you need to have seed compiler 2.6.4 as described in the tutorial above.
      But the fpc make all command will run a final pass using itself so the resulting fpc will have been compiled with fpc 3.00 too.

      After all that is done and the fpc symlinks are fixed as described you can go as pi to the lazarus_1.6 dir and issue make bigide and it will build just fine.

      Reply

      BosseB

      • Feb 21, 2016 - 3:52 AM - hans - Author: Comment Link

        Thanks BosseB!

        I know some users here were working on a script – unfortunately, I didn’t get around to testing any of those yet.
        Is there a script yet that uses “the latest”? Or any way we can capture that in a script, so it always does the latest version?

        Reply

        hans

        • Feb 22, 2016 - 4:57 AM - BosseB Comment Link

          I was doing that and there was additions made by Jim.

          I have now reconfigured the script with the new tag values. It is available here.

          But I have not used it myself after this change since I already have all the other needed stuff….

          Reply

          BosseB

          • Feb 22, 2016 - 5:04 AM - hans - Author: Comment Link

            Thanks! 
            I’ll try it this week and see what I run into. Well done! 

            hans

          • Feb 22, 2016 - 6:24 AM - Jim Kueneman Comment Link

            All I did was ask a question to compile for just the Pi2(ARM7) or for all the Ri Family (ARM6)  I have used it several times since.

            Jim Kueneman

          • Feb 22, 2016 - 7:06 AM - Jim Kueneman Comment Link

            Hans,

              Could you put this somewhere like GitHub and make you, BosseB and myself contributors so we can keep it updated in a single place and have a link to it above in an obvious place? with the notes that with Jessie several of your steps up there are not necessary such as you CAN installed from the default GUI in Jessie, and you DO NOT need to increase the swapfile size.

            Thanks,

            Jim Kueneman

          • Feb 22, 2016 - 7:09 AM - BosseB Comment Link

            Hi Jim,
            I think I got the script from you and then I modified it a bit to get Lazarus installed inside the Pi home and such.

            In any case the last change I made was done in the config section to define the tag to download for Lazarus and where to deposit the files. Nothing changed in the body.

            Hopefully it is useful for some Pi users! :)

            BosseB

          • Feb 22, 2016 - 7:39 AM - Jim Kueneman Comment Link

            Hi BosseB

            I then updated YOUR script, I am running Lazarus from within the Pi user based on your script now.  I added the switch for the ARM version to your base script.

            http://www.mustangpeak.net/install_laz_pi.sh

            This one should be the latest and greatest with all our merged work, unless you had updated you since you posted it.

            Jim

            Jim Kueneman

          • Feb 22, 2016 - 8:05 AM - BosseB Comment Link

            I have modified your script ONLY in the config section where I redefined the LAZDESK, LAZTAG and LAZVER variables to reflect the release version and its tag values.

            So subversion download will use tag lazarus_1_6
            and download into dire 1.6
            Then the desktop file will become lazarus.desktop

            Everything else stays the same.

            BosseB

          • Feb 23, 2016 - 4:29 AM - hans - Author: Comment Link

            Thanks guys for the great work! 

            As for posting it on Github – Maybe that’s something either of you would like to do. After all, the credit goes to you guys for working on the script.

            I’m wondering if we can modify the script in such a way that it will always pick the latest and greatest?
            We could pull the tags directory, ignore all RC versions.
            Or … even write a small app that handles this with a GUI? Allowing updates as well and such?

            hans

  • Mar 2, 2016 - 6:09 AM - Ahmad - Author: Comment Link

    Hi

    The install_laz_pi.sh script stops at line 83:

    svn: E175002: Unable to connect to repository at URL ‘http://svn.frepascal.org/svn/fpc/tags/release_3_0_0’

    svn: E175002: Unexpected HTTP status 400 ‘Bad Request’ on  ‘/svn/fpc/tags/release_3_0_0’

    install_laz_pi.sh: 83: Cannot download fpc source! Aborting

    Reply

    Ahmad

    • Mar 2, 2016 - 9:50 AM - BosseB Comment Link

      That is a typo in the URL (should be two e in freepascal). Don’t know from where it came but it is not in my version of the script in any case.

      The script can be downloaded from my provisional server.

      I have modified it by adding an apt-get command pertaining to making SqlDb calls against MsSQLServer work.

      So with this script Lazarus will be ready to roll with such database accesses too.

      Reply

      BosseB

      • Mar 2, 2016 - 1:44 PM - Ahmad - Author: Comment Link

        Thanks BosseB

        Excuse me for missing ‘e’ in the ‘freepascal ‘ word, but it was typing mistake. The problem exist yet with your script!

        I don’t know SVN basic functionalities, but I’m from Iran and some worldwide companies restricts our access to some services.

        Reply

        Ahmad

    • Mar 2, 2016 - 2:26 PM - BosseB Comment Link

      Were you able to download my script from the link I shown?
      If that is OK then it might be a problem accessing the freepascal svn site from Iran.

      Try to go to this location in your browser:

      http://svn.freepascal.org/svn/fpc/tags/

      You should get to a list of all existing freepascal tags.

      If that works then there is a problem with the way svn works from your end, but I am not able to help further in that case.

      Reply

      BosseB

      • Mar 2, 2016 - 2:47 PM - Ahmad - Author: Comment Link

        Thanks BosseB

        I can see the tags list in my browser.

        Your guess is true. SVN may not work in my country!

        Reply

        Ahmad

  • Mar 6, 2016 - 6:15 PM Comment Link
    PingBack: www.tssoft.de

    […] „How to install Lazarus Pascal on Raspberry Pi 2 (Raspbian)“ von Hans Luitjen […]

  • Mar 9, 2016 - 11:17 AM - luigi Comment Link

    sorry for my bad english…

    i have installed the lazarus on PI 2 (4 core) .. compiled a program and all work…

    but, when i try to use this sd card with the same program on pi 1 mod B+ (1 core)  all work perfctly

    but when i start my program i receive an

    an unhandled exception…..

    EAccessViolation: Access vio;lation at $ 0000027594

    i need to compile the program on PI B+ to use on PI B+?

    Reply

    luigi

    • Mar 9, 2016 - 2:56 PM - hans - Author: Comment Link

      The Pi 2 uses a ARMv7 CPU, where as the older models use a ARMv6 CPU.
      I have never tried running it on an older Pi – maybe recompile it on an older Pi?
      Anyone have experience with this?

      Reply

      hans

    • Mar 9, 2016 - 7:09 PM - Jim Kueneman Comment Link

      Hi,  which script did you run?  I am not sure if BossB implemented my small change that asks when you install Lazarus if you want to compile for just the ARMv7 (Pi2) or all the Pi family (ARMv6 and ARMv7).  

      This is mine and will ask you to enter ARMv6 or ARAMv7 while it runs.

      http://www.mustangpeak.net/install_laz_pi.sh

      Jim

      Reply

      Jim Kueneman

      • Mar 10, 2016 - 3:34 AM - hans - Author: Comment Link

        Reply from Bo:
        The script I am linking to from my temporary webpage did include your modification with the ARM selection.
        But now I have improved a bit on the script so that it offers a default value (ARMv7) so if this is OK the user just has to hit Enter.
        If the user wants to change to ARMv6 he just backs off 7 and enters 6 instead.
        I also added apt-get for a database connectivity library to make Lazarus able to talk to MSSQLServer databases “out of the box”.
        And I restructured the sequence so that the seed compiler is downloaded and installed before the big downloads from svn happen. This way the user interaction with the seed compiler installation comes before the downloads…
        Finally the script is configured for the release versions of both fpc and lazarus.

        Reply

        hans

  • Mar 12, 2016 - 10:58 AM - Yousef Comment Link

    I keep running into this problem over and over. 6-7 times tried and failed. Same error at 

    make all OPT=-dFPC_ARMHF
    make: *** No rule to make target 'all'.  Stop.

    Also when I use ls /usr/local/lib/fpc I get 

    2.6.4  lexyacc

    Please help, been trying to get Lazarus and FPC for the past three weeks.

    Reply

    Yousef

  • Mar 13, 2016 - 1:27 PM - Bernard Ancelle Comment Link

    Hi all

    Great work !

    Thanks for all.

    I got a new RaspberryPi 3 and installed Ubuntu Mate on it.

    I try to run the install_laz_pi.sh and it breaks in the beginning (apt-get update) indicating an error in dpkg.

    I solved it and run again. It does’nt work due to some missing sudo :

    – sudo svn … in line 88,

    – sudo mkdir … several times.

    I manually run each command and it finished (/usr/fpc with both 2.6.4 and 3.0.0 versions, home/pi/dev/lazarus/1.6RC1 populated and /home/pi/.lazarus_1.6RC1 empty).

    The only “strip -s lazarus” command gives an error.

    I manually create the lazarus-test.desktop (I cannot succeed to put it in the /home/pi/.local/share/applications folder which was not created ! I created it manually).

    I put a launcher in the desktop, but it displays an error when running.

    It seems that startlazarus.sh is missing.

    What is its contents ?

    Thanks a lot for your help.

    Best regards.

    Bernard Ancelle

    Reply

    Bernard Ancelle

  • Mar 16, 2016 - 6:36 PM - Ahmad - Author: Comment Link

    Hi

    How to install Lazarus1.6 from below link?

    https://packages.debian.org/sid/lazarus-1.6

    Reply

    Ahmad

    • Mar 17, 2016 - 5:23 AM - hans - Author: Comment Link

      Hi Ahmad,

      took me a bit to look this up, but as far as I know with:

      apt-get -s install lazarus-1.6

      More info in the Debian documentation (look at paragraph 7.13).
      You might have to mention the source, and I have not tested this on a Raspberry Pi.
      If this works, then please let us know 

      Reply

      hans

      • Mar 17, 2016 - 9:10 AM - Ahmad - Author: Comment Link

        Hi Hans

        I have Jessie on the Raspberry Pi and the link is for “SID”!

        When I run “apt-get -s install lazarus-1.6” on Raspberry Pi, it shows:

        E: Unable to locate package lazarus-1.6

        E: Couldn’t find any package by regex ‘lazarus-1.6’ 

        Reply

        Ahmad

      • Mar 17, 2016 - 3:58 PM - hans - Author: Comment Link

        I’d have to play with a Pi to test … I think your apt-get source is not having this package.
        Not sure what ‘SID’ is (sorry for the ignorance).
        I have not played enough with apt-get to determine how to switch sources. 

        Either way, I’d think you’d end up getting the sources and have to compile both compiler (FPC) and Lazarus.
        Maybe someone more experienced with the Debian packages can assist?

        Reply

        hans

    • Mar 17, 2016 - 4:52 PM - BosseB Comment Link

      This blogspot is really about installing FPC/Lazarus from sources and not using binaries precompiled by someone else….

      So did you read and follow the instructions and advice available here?

      And why go to Debian for something specifically geared towards a Raspberry Pi?

      (Trying to post for the second time…)

      Reply

      BosseB

      • Mar 18, 2016 - 5:31 AM - hans - Author: Comment Link

        @BosseB:
        Thanks for not giving up trying to post … the post issues should now be resolved. Thanks man! 

        Reply

        hans

  • Apr 27, 2016 - 12:18 PM - cavadore Comment Link

    On raspberry pi 2, I have this message

    /usr/local/fpc/source# make all OPT=-dFPC_ARMHF
    Makefile:2871: *** The only supported starting compiler version is 3.0.0. You are trying to build with 2.6.4..  Stop.

    what to do ?

    Reply

    cavadore

  • Apr 27, 2016 - 7:58 PM - cavadore Comment Link

    After some investigatio, it seems that this very nice doc is deprecated (April 2016)

    FPC does not compile is version 3.0.0 is not installed and there are no binaries for ARM…

    LAZARUS compile fails here :

    svn2revisioninc.pas(791) Error: Error while linking

    Reply

    cavadore

    • Apr 28, 2016 - 4:25 AM - hans - Author: Comment Link

      I just took a quick look, but FPC 3.0.0 is indeed still available for ARM, see also this post in the Lazarus forum, where Raspberry Pi bundles are announced.

      I have not tested these yet, but it looks promising and suitable for multiple ARM processors:

      ARMV3
      ARMV4
      ARMV4T
      ARMV5
      ARMV5T
      ARMV5TE
      ARMV5TEJ
      ARMV6
      ARMV6K
      ARMV6T2
      ARMV6Z
      ARMV6M
      ARMV7
      ARMV7A
      ARMV7R
      ARMV7M
      ARMV7EM

      Reply

      hans

  • May 1, 2016 - 9:20 PM - Cyril Cavadore Comment Link

    Indeed this is OK,  I did get-apt install fpc and lazarus, it works

    But when I compile a single pascal application with lazarus I have an error and the application crashes (External: SIGSEGV).

     

    Reply

    Cyril Cavadore

    • May 2, 2016 - 4:52 AM - hans - Author: Comment Link

      Hi Cyril,

      Well, since they posted this in the Lazarus Forum, I would assume a build can be made on your Raspberry Pi as well (steps described here and you probably do not need to download anything if you installed the bundle from the Lazarus Forum).
      It also opens the door to ask questions in that particular Lazarus Forum topic.

      The crash makes me think that maybe the wrong processor is defined?

      Reply

      hans

  • Jul 2, 2016 - 10:38 AM - stefanEfg Comment Link

    hi, 

    when enter 

    make all OPT=-dFPC_ARMHF

    i got the error

    Makefile:2887: *** The only supported starting compiler version is 3.0.0. You are trying to build with 2.6.4.. Schluss.

    what can i do??

    Reply

    stefanEfg

    • Jul 3, 2016 - 4:42 AM - hans - Author: Comment Link

      Hi Stefan,

      this guide is already a little older, and it seems you’d need the FPC 3.0.0 compiler to get started.

      In this step:

      mkdir /usr/local/fpc
      cd /usr/local/fpc
      wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.4/fpc-2.6.4.arm-linux.tar
      tar xvf fpc-2.6.4.arm-linux.tar
      cd fpc-2.6.4.arm-linux

      We would need to get FPC 3.0.0, however when looking for 3.0.0 I could not find one for ARM (Raspberry Pi).
      So we should probably get FPC 3.0.0 sources (after downloading 2.6.4) and compile those before we can work with the latest version.
      The sources can be found here: https://sourceforge.net/projects/freepascal/files/Source/3.0.0/

      I will have to go find a Raspberry Pi and try this to determine the exact steps.

      You could give this method a try, maybe they are more up to date than they used to be:

      sudo apt-get update
      sudo apt-get upgrade
      sudo apt-get install fpc
      sudo apt-get install lazarus
      Reply

      hans

      • Jul 3, 2016 - 4:05 PM - stefanEfg Comment Link

        hi hans,

        thanks for your post

        i gave your method a try

        i got fpc ver 2.6.4

        and lazarus ver 1.2.4

        durng first run i got a error message

        The package EditorMacroScript (pascalscript macros) has detected a problem and was deactivated.
        The package failed its selftest with the message:
        "Failed getstr2 [Exp: "456" / Got: "abc"]"

        but the IDE started as I am used to from other systems

        I will test and play around with it in the next days

        bye

        stefan

        Reply

        stefanEfg

        • Jul 4, 2016 - 4:22 AM - hans - Author: Comment Link

          Hi Stefan,

          glad to hear you’re making progress. I did found that message on the Lazarus Forum (see this topic and this topic).
          It does not seem critical (you might want to disable it to prevent future error messages).

          Reply

          hans

  • Dec 30, 2016 - 10:29 AM - Wolfgang Sachs Comment Link

    Thank you for this great tutorial

    I’ve got one comment to this:

    This procedure won`t work anymore cause the compiling of the new repository/trunk of the latest svn of the FPC requires the FPC3.0.0. version at least.

    To complete all you’ve got to install a minimum 3.0.0. version first.

    Refer to this link, where you can get this:  http://forum.lazarus.freepascal.org/index.php?topic=30647.0

    So don’t install the 2.6.4 otherwise the fpc command will conflict with the 3.0 version. Take the 3.0 from the link, install it with the setup.sh and don’t forget to set the PATH instructions so that the fpc will be available in the system. Afterwards proceed as you described in your tuttorial.

    Thank you and Greets

    Wolfgang

    Reply

    Wolfgang Sachs

  • Jan 4, 2017 - 1:08 PM - Dylan Comment Link

    When I run the command ‘make all OPT=-dFPC_ARMHF’ — I get the following error:

    Makefile:2911: *** The only supported starting compiler version is 3.0.0. You are trying to build with 2.6.4.. Stop.

    Please tell me what to do! I’ve been pulling my hair out over this for the last couple of days and I just can’t get it right…

    when I run fpc i get the following version:

    Free Pascal Compiler version 2.6.4 [2014/03/21] for arm

    Reply

    Dylan

    • Jan 4, 2017 - 1:21 PM - hans - Author: Comment Link

      Hi Dylan,

      you’d indeed need the latest FPC compiler 3.0.0. (see also BosseB’s post step 1 – on how to get FPC 3.0.0)
      I have not been able to test or update this article. AFAIK you’d need 2.64 (which you already have) to update to 3.0.0 before building Lazarus.

      Alternatively, you could get it from GetLazarus.org as well.

      Hope this helps. 

      Reply

      hans

      • Jan 6, 2017 - 5:02 PM - BosseB Comment Link

        I am going to modify the script on my blogpage so it gets a seed compiler v 3.0.0 for ARM (Raspberry) by putting the compiler itself without any other stuff in a tar file on my site and directing the script to get seed from there.

        I have been rather busy lately so I have not had time to check the way it will work yet, but as soon as it is done I will reply here with the new script.

        Note: I am extracting the ppcarm file from the GetLazarus package since apparently all one needs as a seed is this file. But I need to test it before releasing the installer script.

        Reply

        BosseB

        • Jan 7, 2017 - 10:10 AM - hans - Author: Comment Link

          Thanks BosseB for chiming in!
          I’m running into the same issue: running out of time hahah …

          Looking forward to your new scrip once you get to it … 

          Reply

          hans

      • Jan 6, 2017 - 5:12 PM - Dylan Comment Link

        Thanks so much for your help, Hans, BosseB! I managed to get FPC 3.0.0 compiled and working with Lazarus 1.2.4. I was not able to compile Lazarus 1.6. I’m not at my Pi at the moment the so I can’t remember the exact error that I got. Something about missing files… 

        But, nonetheless, I’ve got my software to compile successfully! So anything from here on out is a bonus!

        Thanks again.

        Reply

        Dylan

        • Jan 7, 2017 - 10:11 AM - hans - Author: Comment Link

          Awesome! 

          Reply

          hans

          • Jan 9, 2017 - 7:50 AM - Dylan Comment Link

            Hans, I checked back with my Pi and the error I’m getting is this:

            /usr/local/lazarus/source/packager/registration/registerfcl.pas(45,22) Fatal: (10022) Can’t find unit process used by RegisterFCL

            It seems like the FPC installation cannot access it’s own Units… If that makes sense. Is there something I can do about this?

            Dylan

          • Jan 9, 2017 - 8:51 AM - hans - Author: Comment Link

            I have seen that message before, just don’t recall how I fixed it, so I asked out good friend Google which came back with a lot of posts related to that exact message.
            From what I read so far, it might be related to your fpc.cfg file. For example in this post they mention the path being wrong.
            I hope this helps …

            hans

          • Jan 9, 2017 - 3:35 PM - Dylan Comment Link

            Thanks, Hans.

            After hours of attempts and failures I have finally got FPC 3.0.0RC2 installed with Lazarus 1.6RC2.

            I followed your tutorials exact instructions, except when downloading the FPC source from svn I used:

            http://svn.freepascal.org/svn/fpc/tags/release_3_0_0_rc2/

            Instead of:

            http://svn.freepascal.org/svn/fpc/trunk/

            That way I knew I was going to compile version 3.0.0 using 2.6.4 instead of using 2.6.4 to compile one of the nightly releases (which are later than 3.0.0, therefore canoot be compiled by 2.6.4). Which was causing the error from the very beginning.

            In the end these steps worked for me:

            After following all the steps to install FPC 2.6.4:

            cd /usr/local/fpc
            svn co http://svn.freepascal.org/svn/fpc/tags/release_3_0_0_rc2 source
            cd source
            make all OPT=-dFPC_ARMHF
            make install OPT=-dFPC_ARMHF PREFIX=/usr/local
            make install sourceinstall OPT=-dFPC_ARMHF PREFIX=/usr/local

            Dylan

          • Jan 10, 2017 - 2:35 PM - hans - Author: Comment Link

            Thanks for posting Dylan!! 

            I see that BosseB made FPC 3.0.0 also available on his website / through is script.
            But it’s always very good to know how got there! 

            hans

  • Jan 9, 2017 - 9:38 AM - BosseB Comment Link

    I just want to reveal that I have put the 3.0.0 seed compiler for RPi2-RPi3 on my website.

    This means that the installer script needs to be modified to grab that seed compiler than the 2.6.4 version from SourceForge.
    Here is how:

    In the section about downloading and installing the seed compiler replace the existing lines with this:

    cd /usr/fpc || error_exit "$LINENO: Cannot access directory /usr/fpc! Aborting"
    sudo wget http://blog.boberglund.com/projects/freepascal/files/Linux/3.0.0/fpc-3.0.0.arm-linux.tar  || error_exit "$LINENO: Cannot download seed compiler! Aborting"
    sudo tar xvf fpc-3.0.0.arm-linux.tar || error_exit "$LINENO: Cannot expand tar file! Aborting"
    sudo rm fpc-3.0.0.arm-linux.tar
    sudo ln -sf /usr/fpc/ppcarm /usr/bin/ppcarm || error_exit "$LINENO: Cannot create symlink to new fpc compiler! Aborting"

    Remove the other lines dealing with the 2.6.4 seed compiler such as running the install.sh script.

    Note: I have not tested the script with the change above, I am working on a total overhaul of the script so it will no longer need sudo and it won’t install anything outside of the user home dir (/home/pi/).

    You might need to add the option FPC=/usr/bin/ppcarm to the make commands, but I think that the symlink should be enough.

    Reply

    BosseB

    • Jan 10, 2017 - 12:56 PM - BosseB Comment Link

      I have now tested it and it turns out that 2.6.4 is still needed to build FPC 3.0.0 as a seed compiler.

      So I have uploaded another file to the website containing this and nothing else. It makes the download a lot smaller too and my site seems to be faster than SourceForge in my tests. The download command is:

      wget http://blog.boberglund.com/projects/freepascal/files/Linux/2.6.4/fpc-3.0.0.arm-linux.tar
      Reply

      BosseB

    • Jan 10, 2017 - 2:33 PM - hans - Author: Comment Link

      Thanks BosseB!
      I was already afraid we’d otherwise had to go to 2.6.4 -> 3.0.0 route, but having it available like that is much easier 

      Reply

      hans

      • Jan 10, 2017 - 3:17 PM - BosseB Comment Link

        Notice that the only file needed for a seed compiler is ppcarm itself, no other files are needed to build FPC itself.
        And to be sure one can specify FPC=<path to ppcarm> on the make command line, so a symlink is also not needed.

        Once that has been done and FPC 3.0.0 is present one can rebuild FPC using itself too. But the make program senses that FPC has not been built yet and then it REQUIRES 2.6.2…

        Reply

        BosseB

  • Jan 10, 2017 - 3:13 PM - BosseB Comment Link

    I can report a strange new problem with Lazarus on a RPi3 with Raspbian PIXEL (the latest version of Raspbian):

    When one starts Lazarus main top window uses only about 60% of my screen width and there is no way I can resize the window either! Even the maximize button is disabled, so one cannot change the width of Lazarus at all…
    The other windows are normal and resizable as expected.

    Reply

    BosseB

    • Jan 10, 2017 - 3:16 PM - hans - Author: Comment Link

      Since I bought a Pine64 when I should have bought a RPi3, I better go order one to test this.
      That sounds like a strange and not very practical issue … 

      Reply

      hans

    • Jan 12, 2017 - 5:52 PM - BosseB Comment Link

      I have now checked that this is a problem with Lazarus 1.6.2 and is reported by others as well on the lazarus mail list. Lazarus 1.6 on the same system does not behave this way. It resizes as expected.

      Reply

      BosseB

  • Jan 12, 2017 - 6:03 PM - BosseB Comment Link

    Update on the installation system:
    I have now verified that Lazarus and FPC can be installed on a Raspbian RPi3 in such a way as to keep everything local below /home/pi and therefore no sudo or such things are needed.

    I updated my installation script and made it available on my website:

    This script relies on svn to get the sources of both FPC and Lazarus and it uses a 2.6.4 seed compiler from my site since that is the only acceptable seed to build FPC 3.0.0 with. When FPC 3.0.2 is out it will need the 3.0.0 seed, which is also available (just edit the script and change 2.6.4 to 3.0.0 in the line that fetches the tar file).

    All dependencies and tools needed are installed by the script too, so it works on a brand new installation.

    Advice:
    It puts the binaries into /home/pi/bin, which is created if it does not yet exist. This dir is automatically added to path by Rasbian if it exists when one logs on. So the best way is to create the bin dir if it does not exist, then log off from the system and log on again. Now /home/pi/bin should be on path.
    The script will fix the path if bin is not existing so the remaining parts of the script will work, but it is not permanent. So therefore the procedure above is recommended.

    Reply

    BosseB

    • Jan 13, 2017 - 8:53 AM - hans - Author: Comment Link

      Hi BosseB,

      Thank you so much for doing all this work and making it available to people! 
      Well done!

      Reply

      hans

    • Aug 25, 2017 - 11:31 AM - Don M Comment Link

      Echoing thanks for all your work and for making it public.  I have been banging my head against the wall for days trying to get a modern version onto a PI 3 – and your script has finally ended the pain…

      Reply

      Don M

  • Jan 16, 2017 - 10:14 AM - Joe Comment Link

    Received the following error using your script (last updated 1/8/17):

    make[1]: Entering directory ‘/home/pi/dev/lazarus/1.6.2/packager/registration’

    /bin/rm -f ../units/arm-linux/fcllaz.ppu

    /bin/mkdir -p ../units/arm-linux

    /home/pi/bin/ppcarm -MObjFPC -Scghi -O1 -g -gl -l -vewnhibq -Fu. -FE. -FU../units/arm-linux -dFPC_ARMHF -darm fcllaz.pas

    Hint: (11030) Start of reading config file /etc/fpc.cfg

    Hint: (11031) End of reading config file /etc/fpc.cfg

    Free Pascal Compiler version 3.0.0 [2017/01/16] for arm

    Copyright (c) 1993-2015 by Florian Klaempfl and others

    (1002) Target OS: Linux for ARMHF

    (3104) Compiling fcllaz.pas

    Fatal: (10022) Can’t find unit system used by fcllaz

    Fatal: (1018) Compilation aborted

    Makefile:2702: recipe for target ‘fcllaz.ppu’ failed

    make[1]: *** [fcllaz.ppu] Error 1

    make[1]: Leaving directory ‘/home/pi/dev/lazarus/1.6.2/packager/registration’

    Makefile:3050: recipe for target ‘registration’ failed

    make: *** [registration] Error 2

    install.sh: 173: Cannot make Lazarus bigide! Aborting

    root@pentadee:/home/pi#

    Reply

    Joe

  • Jan 22, 2017 - 1:41 PM - alexander Comment Link

    Hi. I got next error.

    make[1]: Leaving directory ‘/home/pi/dev/lazarus/1.6.2/components/chmhelp/lhelp’

    make -C packager/registration

    make[1]: Entering directory ‘/home/pi/dev/lazarus/1.6.2/packager/registration’

    /bin/rm -f ../units/arm-linux/fcllaz.ppu

    /bin/mkdir -p ../units/arm-linux

    /home/pi/bin/ppcarm -MObjFPC -Scghi -O1 -g -gl -l -vewnhibq -Fu. -FE. -FU../units/arm-linux -dFPC_ARMHF -darm fcllaz.pas

    Hint: (11030) Start of reading config file /etc/fpc.cfg

    Hint: (11031) End of reading config file /etc/fpc.cfg

    Free Pascal Compiler version 3.0.0 [2017/01/22] for arm

    Copyright (c) 1993-2015 by Florian Klaempfl and others

    (1002) Target OS: Linux for ARMHF

    (3104) Compiling fcllaz.pas

    Fatal: (10022) Can’t find unit system used by fcllaz

    Fatal: (1018) Compilation aborted

    Makefile:2702: recipe for target ‘fcllaz.ppu’ failed

    make[1]: *** [fcllaz.ppu] Error 1

    make[1]: Leaving directory ‘/home/pi/dev/lazarus/1.6.2/packager/registration’

    Makefile:3050: recipe for target ‘registration’ failed

    make: *** [registration] Error 2

    install_lazfpc_local_pi.sh: 173: Cannot make Lazarus bigide! Aborting

    Reply

    alexander

    • Jan 23, 2017 - 12:06 AM - Dylan Comment Link

      This is what you must do:

      Assuming you are running on VNC straight on the Pi. You will need to do a find and replace in the FPC config file.

      So if you’re running VNC or if you’re using the Pi’s HDMI out you will use LeafPad to do so:

      $ sudo leafpad /etc/fpc.cfg

      The file will now open in leafpad.

      Look for the section labelled:

      # -----------------------
      # Set Filenames and Paths
      # -----------------------

      You need to see if your Compiler is looking in the right place for it’s dependencies.

      For instance, in my case, the path for the first file will be:

      #-Fr/usr/local/lib/fpc/$fpcversion/msg/errore.msg

      But in your case it might be: 

      #-Fr/usr/lib/fpc/$fpcversion/msg/errore.msg

      You need to make sure that all the paths in your file are the same as mine.

      Meaning:

      /usr/lib/fpc

      must be replaced with

      /usr/local/lib/fpc

      To do this click ‘Search’ and then ‘Replace’.

      In ‘Find What’ type ‘/usr/lib/fpc’ (Or whatever your path may be)…

      In Replace with type ‘/usr/local/lib/fpc’

      Click ‘Find and replace’.

      Save and close the file.

      It should work now…

      If not it means your FPC sources are somewhere else. You need to find them and then fix the paths in the fpc.cfg file. Because that is the only reason you will receive the error message.

      Reply

      Dylan

  • Jan 25, 2017 - 3:17 AM - sagar Comment Link

    Hi 

    i am using this ‘ install_lazfpc_local_pi.sh ‘ shell script  to install lazarus 1.6.2 on my raspberry pi 3. i have installed raspbian jessie on it.i am getting below error message.

    could you please help me ? what does this messages means. 

    /usr/bin/ld: warning: ./link.res contains output sections; did you forget -T?

    make[2]: Leaving directory ‘/home/pi/dev/fpc/3.0.0/installer’

    make[1]: Leaving directory ‘/home/pi/dev/fpc/3.0.0’

    /bin/echo Build > build-stamp.arm-linux

    /bin/echo Build > base.build-stamp.arm-linux

    make: -iVSPTPSOTO: Command not found

    make compiler_cycle RELEASE=1

    make[1]: Entering directory ‘/home/pi/dev/fpc/3.0.0’

    make[1]: -iVSPTPSOTO: Command not found

    make -C compiler cycle

    make[2]: Entering directory ‘/home/pi/dev/fpc/3.0.0/compiler’

    make[2]: -iVSPTPSOTO: Command not found

    make tempclean ppc3.exe

    make[3]: Entering directory ‘/home/pi/dev/fpc/3.0.0/compiler’

    make[3]: -iVSPTPSOTO: Command not found

    /bin/rm -f ppcross ppc ppc1.exe ppc2.exe ppc3.exe ./msg2inc.exe pp1.wpo pp2.wpo

    make ‘OLDFPC=’ next CYCLELEVEL=1

    make[4]: Entering directory ‘/home/pi/dev/fpc/3.0.0/compiler’

    make[4]: -iVSPTPSOTO: Command not found

    make rtlclean rtl

    make[5]: Entering directory ‘/home/pi/dev/fpc/3.0.0/compiler’

    make[5]: -iVSPTPSOTO: Command not found

    make -C clean

    make[6]: Entering directory ‘/home/pi/dev/fpc/3.0.0/compiler’

    make[6]: *** clean: No such file or directory. Stop.

    make[6]: Leaving directory ‘/home/pi/dev/fpc/3.0.0/compiler’

    Makefile:4078: recipe for target ‘rtlclean’ failed

    make[5]: *** [rtlclean] Error 2

    make[5]: Leaving directory ‘/home/pi/dev/fpc/3.0.0/compiler’

    Makefile:3967: recipe for target ‘next’ failed

    make[4]: *** [next] Error 2

    make[4]: Leaving directory ‘/home/pi/dev/fpc/3.0.0/compiler’

    Makefile:3972: recipe for target ‘ppc1.exe’ failed

    make[3]: *** [ppc1.exe] Error 2

    make[3]: Leaving directory ‘/home/pi/dev/fpc/3.0.0/compiler’

    Makefile:3984: recipe for target ‘cycle’ failed

    make[2]: *** [cycle] Error 2

    make[2]: Leaving directory ‘/home/pi/dev/fpc/3.0.0/compiler’

    Makefile:2780: recipe for target ‘compiler_cycle’ failed

    make[1]: *** [compiler_cycle] Error 2

    make[1]: Leaving directory ‘/home/pi/dev/fpc/3.0.0’

    Makefile:2812: recipe for target ‘build-stamp.-‘ failed

    make: *** [build-stamp.-] Error 2

    install_lazfpc_local_pi.sh: 150: Cannot make install! Aborting

    especially above line my installation always getting stuck at this place. please let me out.

    thank you,

    Sagar Chavan

    Reply

    sagar

  • Jan 27, 2017 - 5:49 AM - Finn Inge Langeland Comment Link

    Hi,

    I have a major challenge. I bought the Raspberry Pi 2 yesterday. While trying to install freepascal, I get errors at stage:

    make all OPT=-dFPC_ARMHF

    “Makefile:2911:  *** The only supported starting compiler version is 3.0.0. You are trying to build with 2.6.4..  Stop”

    Is there an easy fix for this compiler version issue?

    Hoping to hear from you real soon.

    br

    Finn Inge Langeland

    Reply

    Finn Inge Langeland

    • Jan 27, 2017 - 9:22 AM - hans - Author: Comment Link

      Hi Finn,

      yes there is; you’d have to scroll up a few messages back, look for the posts by BosseB – he did some excellent work on that topic!

      Reply

      hans

  • Mar 12, 2017 - 6:30 AM - Tibi! Comment Link

    Got the same error message while building Lazarus:
    ‘Can’t find unit db used by fcllaz’

    There is a bundled script one can use to generate the .fpc.cfg file (it was missing after building fpc 3.1.1), for me the script is located at:
    /usr/lib/fpc/3.1.1/samplecfg

    After writing out .fpc.cfg, i added paths to it under ‘# searchpath for units and other system dependent things’:
    -Fu/usr/lib/fpc/3.1.1
    -Fu/usr/lib/fpc/3.1.1/*
    -Fu/usr/lib/fpc/3.1.1/units/*
    -Fu/usr/lib/fpc/3.1.1/units/arm-linux/*

    Then Lazarus can be compiled. 

    It would be nice to handle the above hassle in BosseB’s script.

    If you are getting ‘Can’t call the resource compiler “/usr/bin/fpcres”, switching to external mode’, then you are on low swap file:
    Change ‘CONF_SWAPSIZE=100’ from 100 to 2000 in ‘/etc/dphys-swapfile’ then reboot.

    Reply

    Tibi!

    • Mar 12, 2017 - 5:17 PM - hans - Author: Comment Link

      Hi Tibi!

      Thank you very much for the tip and suggestion! 
      It’s very much appreciated! 

      Reply

      hans

  • Jul 26, 2017 - 7:52 AM - Oscar Comment Link

    Hey There! Has anyone tried compiling a project originally created under Windows? I followed the instructions given on this site and I’m able to compile a simple project in Lazarus under a Raspberry Pi 2. I’ve imported a project I’ve been working on in windows to try and compile to for the raspberry but when I click “run” the execution stops with a “Error while linking”. Any idea what might be wrong?

    Reply

    Oscar

    • Jul 26, 2017 - 11:08 AM - hans - Author: Comment Link

      Hi Oscar,

      I have done something similar; build my application under MacOS X and then recompile on the Raspberry Pi.
      The “error while linking” might refer to a unit or file that might not be supported on the Raspberry Pi.
      Do you have more details about the output?

      Reply

      hans

      • Jul 26, 2017 - 12:51 PM - Oscar Comment Link

        Thanks Hans! Unfortunately it doesn’t say anything else. It simply says “Generic Linking Error” with no additional output as to what might be causing it. I assumed it has something to do with some unit clashing with the OS or something, but can’t really tell which because I have no additional information.

        Is there a way I can single-out which units I want to compile? I can only set which “Forms” I want lazarus to build/compile. However units are always compiled. If I could somehow choose which units I want lazarus to compile, I could maybe check where this linking error might be occurring. 

        Thanks anywa!

        Reply

        Oscar

        • Jul 26, 2017 - 2:44 PM - Oscar Comment Link

          Nevermind, I figured it out. The “linking” error was caused by some libraries that weren’t compatible with my linux distribution. The IDE wasn’t throwing any library-related error when compiling, and it wasn’t pointing to any library in particular. What I did was the following:

          1- Removed all units from the project inspector

          2- Add them again

          3- Do a clean/build of the IDE (I’m inclined to believe this was the ONLY thing needed, but I’d clean/built it before and nothing changed so I’m not 100% sure)

          After trying to compile (following the clean/build) the IDE was showing me exactly which libraries were causing the linking issue. Wrapping things between {$IFDEF WINDOWS}{ENDIF} did the trick. The “error while linking” is no longer an issue.

          Thanks for all! If it wasn’t for this tutorial, I’d have never gotten lazarus to work on my RaspBerry.

          Reply

          Oscar

        • Jul 28, 2017 - 8:52 AM - hans - Author: Comment Link

          Hi Oscar!

          Awesome, glad to hear you found those libraries – it can be a pain to find that one single little file that causes a generic error message.
          Thanks for posting your procedure!
          If you don’t mind me asking: which libraries caused the issue? 

          Reply

          hans



Your Comment …

Friendly request to not post large files here (like source codes, log files or config files). Please use the Forum for that purpose.

Please share:
*
*
Notify me about new comments (email).
       You can also use your RSS reader to track comments.


Tweaking4All uses the free Gravatar service for Avatar display.
Tweaking4All will never share your email address with others.