Recent

Author Topic: Tutorial: Install Lazarus to Raspberry Pi  (Read 45693 times)

Linkat

  • New Member
  • *
  • Posts: 19
Tutorial: Install Lazarus to Raspberry Pi
« on: August 17, 2019, 04:14:22 pm »
Hi Raspi user,
because in the past 6 years I had a lot of trouble to install the current stable Lazarus versions with all the differently methods to my raspis, I wrote this tutorial. I'm sure there will be problems in the future too. So please give me information about this problems and how to solve this problems, so I can work on this tutorial.
Hopefully you'll have success with the installation.

The Raspberry Pi computers is a story of success. Unfortunately Lazarus is a language with minor importance on this. A main reason for it is, that the installation of Lazarus is to complex.

For the Intel- and AMD-CPU you have the easy to install deb- and rpm-packages.

So it would be very useful, if we had packages for the arm-CPU in the same way.

By the way: I think it would be nice to have a own section for the Raspberry Pi in this forum.

I hope we'll have a good discussion on it.

Handoko

  • Hero Member
  • *****
  • Posts: 5130
  • My goal: build my own game engine using Lazarus
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #1 on: August 17, 2019, 04:26:54 pm »
I've purchased my Raspberry but busy still don't have time to try it. Your tutorial will be very useful to me. Will follow your method when I have time.

Thank your for sharing it.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #2 on: August 19, 2019, 04:57:10 am »

Thaddy

  • Hero Member
  • *****
  • Posts: 14199
  • Probably until I exterminate Putin.
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #3 on: August 19, 2019, 08:50:13 am »
Do the Wiki instructions no longer work?

See: https://wiki.freepascal.org/Lazarus_on_Raspberry_Pi#Simple_installation_under_Raspbian

Yes, they still work.  Raspbian Buster has fpc 3.0.4 and lazarus 2.0.0
As simple as sudo apt-get install fpc && sudo apt-get install lazarus.
Note that you will have to check of all paths are set up correctly in /etc/fpc.cfg

I would recommend, though, to install just fpc 3.0.4, then check out lazarus fixes and do make all install. After lazarus is compiled start lazarus, add/remove the packages you want (like OPM and  the two anchordocking) .
Subsequent re-compiles can be done with make clean all useride. Note you need to create a swap file with size 1024MB for this to work.
« Last Edit: August 19, 2019, 08:54:36 am by Thaddy »
Specialize a type, not a var.

Thaddy

  • Hero Member
  • *****
  • Posts: 14199
  • Probably until I exterminate Putin.
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #4 on: August 19, 2019, 09:06:36 am »
Hi Raspi user,
because in the past 6 years I had a lot of trouble to install the current stable Lazarus versions with all the differently methods to my raspis, I wrote this tutorial. I'm sure there will be problems in the future too. So please give me information about this problems and how to solve this problems, so I can work on this tutorial.
Hopefully you'll have success with the installation.
Thanks for the effort, but it is not necessary, because there are supported .debs in the Rasbian repository that are created and maintained by Debian.
If  you perform these simple steps you can subsequently update your installations by building from source and gives you a good and proper foundation to work with.

The recommended way is different from yours
Simply this is enough and strongly recommended:
Code: Bash  [Select][+][-]
  1. sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install fpc && sudo apt-get install lazarus

For Raspbian buster this installs fpc 3.0.4 and Lazarus 2.0.0 and all its dependencies. and creates menu entries and icons.

Just verify that all the paths are correct in /etc/fpc.cfg
The install base is /usr so /usr/bin/ for the compiler and  /usr/lib/arm-linux-gnueabihf/fpc/3.0.4/ for the libraries.
If you need to adapt paths, use $FPCVERSION instead of 3.0.4.
Normally the paths are correct, but not if you have any previous installed versions or used an install from the freepascal or lazarus website. (these install in /usr/local)

===========================================================================================================================
The next is only necessary if you did not follow the above install previously:
Trouble shooting guidelines before a recommended install:
Steps for messed up and previous installations before installing from apt:
Should you have installations from the fpc/lazarus website first remove those:
Code: Bash  [Select][+][-]
  1. sudo apt-get purge lazarus && sudo apt-get purge fpc && sudo apt-get autoremove
If you did previously build from source, go to the directory root with the fpc directory as child and do
Code: Bash  [Select][+][-]
  1.  sudo rm -rf fpc && sudo rm /etc/fpc.cfg
do the same for lazarus, go to the parent directory of the lazarus directory and
Code: Bash  [Select][+][-]
  1.  sudo rm -rf lazarus
Last step: delete the hidden lazarus directory in /home/<user>:
Code: Bash  [Select][+][-]
  1. cd /home/<username>
  2. sudo rm -rf .lazarus
  3.  
Note the dot: it is a hidden directory (if it exists)

After that you can perform the above recommended  installation from apt without trouble.
« Last Edit: August 19, 2019, 10:03:35 am by Thaddy »
Specialize a type, not a var.

Linkat

  • New Member
  • *
  • Posts: 19
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #5 on: August 19, 2019, 04:49:42 pm »
Yes, with  the lazarus debian-packages you get the Lazarus 2.0.0 version. Not bad, but not good enough. If I work on my desktop with the 2.0.4 version, I would like to work with the current version on my raspi  too.

In the internet (wiki etc.) you can find some descriptions, most of them are pretty old, and you will have some problems. So for me, to have a new  and stable Lazarus version in the /usr directory is the way, I described in the tutorial above. Especially for beginners the installation should be easy.

For the Intel- and AMD- PC, nobody demands such a complicated installation. You have the deb- or rpm- packages for it.

But the best would be, if we had packages for raspian to install Lazarus.

The raspberry pi users would be glad to have an easy way to install Lazarus. I'm sure we'll find a lot of new lazarus-users with it.

Where are the people who can make these packages?

Thaddy

  • Hero Member
  • *****
  • Posts: 14199
  • Probably until I exterminate Putin.
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #6 on: August 19, 2019, 06:08:11 pm »
Yes, with  the lazarus debian-packages you get the Lazarus 2.0.0 version. Not bad, but not good enough. If I work on my desktop with the 2.0.4 version, I would like to work with the current version on my raspi  too.

In the internet (wiki etc.) you can find some descriptions, most of them are pretty old, and you will have some problems. So for me, to have a new  and stable Lazarus version in the /usr directory is the way, I described in the tutorial above. Especially for beginners the installation should be easy.

For the Intel- and AMD- PC, nobody demands such a complicated installation. You have the deb- or rpm- packages for it.

But the best would be, if we had packages for raspian to install Lazarus.

The raspberry pi users would be glad to have an easy way to install Lazarus. I'm sure we'll find a lot of new lazarus-users with it.

Where are the people who can make these packages?
The point of my advice is to have a proper install first!.
After that it is quite easy to build a new lazarus from source..
Most noobs fall over the first hurdle, because they make assumptions that are not warranted, like that the freepascal provided packages are better.
Do not try anything different.
Specialize a type, not a var.

af0815

  • Hero Member
  • *****
  • Posts: 1288
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #7 on: August 19, 2019, 09:56:33 pm »
i use the best tool for installing 😊 fpcupdeluxe. so it is meaningless if i use windows, a linux on a pc or raspi. and i can handle more than one install or crosscpmpilers.
regards
Andreas

Linkat

  • New Member
  • *
  • Posts: 19
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #8 on: August 23, 2019, 06:52:42 pm »
@af0815 good to here that you are happy with the fpcupdeluxe.
And I think it's a good tool for not standard installation.
For me: this fpcupdeluxe is an overkill for beginners. And for every new lazarus version you need a new fpcupdeluxe version.

My favorite is not a manually  installation (like the tutorial).
I prefer a just-in-time lazarus-stable package for the raspbian OS like you have it for the Intel/AMD CPU. Thats it.

Who is a packager, who can do this?


Thaddy

  • Hero Member
  • *****
  • Posts: 14199
  • Probably until I exterminate Putin.
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #9 on: August 23, 2019, 07:31:13 pm »
i use the best tool for installing 😊 fpcupdeluxe. so it is meaningless if i use windows, a linux on a pc or raspi. and i can handle more than one install or crosscpmpilers.
Unfortunately it does not explain the swap size! nor does it work without a swap size >= 1 GB
That is absolutely required on systems below 2 GB. E.g, everything but a raspberry 4 with at least 2 GB memory.

Currently fpcdeluxe "assumes" you have already done that.
(and I am a bit tired to repeat myself|)
« Last Edit: August 23, 2019, 07:34:22 pm by Thaddy »
Specialize a type, not a var.

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1739
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #10 on: August 23, 2019, 09:54:32 pm »
Will see if I can add a warning about SWAP into fpcupdeluxe.
For certain it will never get tired.

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #11 on: August 24, 2019, 08:10:27 am »
....
I would recommend, though, to install just fpc 3.0.4, then check out lazarus fixes and do make all install. After lazarus is compiled start lazarus, add/remove the packages you want (like OPM and  the two anchordocking) .
Subsequent re-compiles can be done with make clean all useride. Note you need to create a swap file with size 1024MB for this to work.

I agree. If there is a distro provided fpc 3.0.4, use that (but install it with a tool that resolves dependencies),  then download Lazarus fixes source and build. Its easy and you end up with a flexible system, easy to track new developments in Lazarus.  As long as official Lazarus releases are based on 3.0.4 this is by far the best way to go.

The wiki page https://wiki.freepascal.org/Installing_Lazarus_on_Linux shows it step by step including how to get icons and menu entries.  I don't have a Pi with me but expect that recipe will work there too. The Pi is, after all, a Linux box.

Dependencies ?   "apt install ...", "apt-get install ..." and gdebi  all resolve dependencies. "dpkg -i ..." does not !

Davo

 
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Mi-Ki

  • Jr. Member
  • **
  • Posts: 74
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #12 on: August 25, 2019, 10:26:11 am »
Hi
I'm a beginner in Lazarus.
I have Raspberry 4 4GB RAM - raspbian-buster
CONF_SWAPSIZE=1024

They don't add packers
lazarus.pp(1,1) Fatal: Cannot find fpdebug used by Lazarus.
How to solve?
Thank you
« Last Edit: August 25, 2019, 10:27:42 am by Mi-Ki »

Linkat

  • New Member
  • *
  • Posts: 19
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #13 on: August 25, 2019, 07:01:09 pm »
Hi Mi-Ki,
what was your method to install Lazarus?
Did you use the tutorial in the first post of this thread?


dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #14 on: August 26, 2019, 06:38:12 am »
Disclaimer, I don't have a pi with me so what I say here is 'linux' generically. Sort of valid.

Quote
Fatal: (10022) Can't find unit system used by fcllaz

The system unit is provided by fpc, you should have an entry in your /etc/fpc.cfg that looks a bit like -
Code: Pascal  [Select][+][-]
  1. # searchpath for units and other system dependent things
  2. -Fu/usr/lib/x86_64-linux-gnu/fpc/$fpcversion/units/$fpctarget

(not a lot like it, obviously it won't say /x86_64.. but you get the idea. It should point to a place where there are a lot of fpc units.

fpdebug is provided by the lazarus source, its in [Lazarus source dir]/components/fpdebug

Generally, I don't like the idea of putting source that you intend to compile under /usr/lib.  There is no need, you can build Lazarus as an ordinary user in your home directory. You might want to then do a make install but there is absolutly no need to, cd into the lazarus dir, where the "lazarus" binary is (after a successful build) and run launch from there.

Davo



Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

 

TinyPortal © 2005-2018