Recent

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

dbannon

  • Hero Member
  • *****
  • Posts: 2778
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #90 on: July 16, 2020, 03:11:48 am »
jcdammeyer, I really feel for you, you are getting well meaning advice from all quarters and I have been part of that.  And sadly will continue to do so ...

rvk's script is cool but it has two problems IMHO, firstly, it goes to a lot of trouble to download a boot compiler and the build FPC from that, secondly, it scripts a fairly complicated process that is done, but most users, very infrequently. Step by step is safer.

A far easier approach, again, IMHO, on just about any Linux system (and Rasberry Pi is just another Linux system) is to install FPC from a tar ball, see https://wiki.lazarus.freepascal.org/Installing_the_Free_Pascal_Compiler#FPC_Tar_Balls and then  download and compile Lazarus, this is documented at https://wiki.freepascal.org

Both documented processes are a handful of steps, not a script, because that way, you can adapt as you see fit and you can see, and isolate any errors when they happen.

The only non "Linux standard" thing there is the need to increase swap space (as per rvk's script), something that not uncommon on Raspberry Pi and other systems with not a lot of memory.

I hope I have not made things worse.

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

jcdammeyer

  • Full Member
  • ***
  • Posts: 205
  • Embedded System Developer
    • Automation Artisans Inc.
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #91 on: July 16, 2020, 03:38:25 am »
I hope I have not made things worse.
Davo
Not worse actually.  All these suggestions have led me to the fpcupdeluxe which is pretty neat.   At the moment on the Pi3 I'm editing using Lazarus 2.0.10 which is the same version as the Windows one.  And it's almost working on the Beagle except I think that when I started the program and install sequence I made a rather dumb mistake.  I think I was using a root terminal.  So the whole thing installed as root with root permissions.  Now trying the generic project (with 2.0.10 BTW) I run into write permissions for saving files and compiling etc.  So not quite working but it's the thought that counts  ;)

Not only that it put it all in the Downloads folder for some reason and didn't create a desktop ICON which was properly created on the Pi3 and in the user folder.  Again probably because of write permissions. 

Had to increase swap space on BB what with only that tiny bit of 512MB of Ram.  I can remember compiling with only 64K using Turbo Pascal and CP/M-80. (The 8" floppies didn't hold a lot either).  Given that the MicroSD card doesn't do a lot of leveling in the long run the swap space would be better suited to an external hard drive on USB or even an actual RAM drive.  Now that would be an interesting product.  Recycled PC RAM sticks turned into USB RAM drives.

So at the moment I'm pretty impressed with fpcupdeluxe.  Expecially with it's cross platform capabilities.  When it finally finishes on WIN-7 we'll see what it's created.

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1738
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #92 on: July 16, 2020, 07:54:30 am »
@jcdammeyer
The fpcupdeluxe RPi binaries you are using, are build on Windows. As are all other binaries !
I have many RPi running 24/7 that run servers, daemons and GUI apps, all cross-compiled from Windows.
However, when debugging is needed, I have a very fast headless ODROID (arm64) with a local install of FPC and Lazarus. With vncserver and vncclient, I am debugging remotely on the same Windows PC.

jcdammeyer

  • Full Member
  • ***
  • Posts: 205
  • Embedded System Developer
    • Automation Artisans Inc.
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #93 on: July 16, 2020, 08:13:20 am »
@DonAlfredo
It never did complete on WIN-7.  Black window that never went away.  Now both the Pi and the Beagle also had a black screen for a while.  I just left them.  Eventually they recovered. 
I also found that because I'd inadvertently used the the root terminal that the fpcupdeluxe lazarus was on the root desktop and when I logged into root instead I could install the component and run the application all under 2.0.10.

On the Beagle I  created a much larger swap file.  Cleaned out the old folders that had root ownership and now I'm trying again.

I'm interested in learning more about what you do with windows and the cross compile. 

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1738
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #94 on: July 16, 2020, 09:02:16 am »
I do not have a Win7 anymore. If I have one available will try to test. Might be interesting.

About installing.
You followed the right path. Always start by using the official installers for FPC and Lazarus. These should work, if maintained properly.
For special things like easy crossing or testing trunk or multi-installs or as a last resort or just for fun, you could use fpcupdeluxe.

jcdammeyer

  • Full Member
  • ***
  • Posts: 205
  • Embedded System Developer
    • Automation Artisans Inc.
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #95 on: July 16, 2020, 09:36:36 am »
I do not have a Win7 anymore. If I have one available will try to test. Might be interesting.

About installing.
You followed the right path. Always start by using the official installers for FPC and Lazarus. These should work, if maintained properly.
For special things like easy crossing or testing trunk or multi-installs or as a last resort or just for fun, you could use fpcupdeluxe.

I finally bit the bullet and bought an HP ZBook with WIN-10.  At the moment I haven't seen a single thing that makes it any better than WIN-7. 

Anyway, the Beagle is still busy compiling.  I've never quite understood why 1 GHz singlecore processor running a lean version of Linux is so much slower than a WIN-XP PC with one core and about the same amount of memory.   The work I did in the first decade of this millennium on that WIN-XP system (including a lot of Delphi) felt then and now more comfortable that Linux on the Beagle.

It's probably because I don't know something.  And since I don't know what I don't know it's really hard to figure out.

What I am impressed with is the FPCUPdeluxe.  The ability to grab a version of FPC and Lazarus and build them with minimal problems is outstandingly impressive! Oh what the heck. a few more !!!!!

I come from an era where my compiler writing professor told us that eventually memory would be so large that to do good error detection etc."add another pass".  He had us doing things like that to show how we could continue to compile even when a blatant coding error would cause most compilers to choke.

We worked on an Ahmdal 470 and wrote our assignments in FLACC.  (Algol=68)  We had a budget for computer time and the FLACC compiler was expensive.  What would take 0.1 seconds with Algol-W might take a second with the FLACC.  But, if it generated 32 error messages we learned very quickly to fix all 32 because all 32 were accurate.  If you only fixed the first few like you might with other compilers you'd discover very quickly that another 1 second of computer time burned up your assignment budget very quickly.  I've never seen another compiler that does that as well as the FLACC.

Here are the links.  My professor was Chris Thompson.
https://en.wikipedia.org/wiki/FLACC 
https://en.wikipedia.org/wiki/ALGOL_68

I think it's why I like Delphi and Lazarus.

Edit:  This link is priceless and well worth the read:
http://www.softwarepreservation.org/projects/ALGOL/book/Thomson-FLACC%20thesis.pdf
« Last Edit: July 16, 2020, 09:41:20 am by jcdammeyer »

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1738
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #96 on: July 16, 2020, 10:00:48 am »
Quote
I finally bit the bullet and bought an HP ZBook with WIN-10
Good decision. Win10 is very good. And now install VirtualBox !!  :D

The thesis poses an interesting programmer starting point: "cafetaria" programming.
For me, 100% true when I was a student and even today !

Remember, fpcupdeluxe is just a tool around FPC and Lazarus.
The real magic starts with these two. So many systems supported. Amazing.

Ps.
Long time ago, I started with 1 second mainframe Pascal compiling and executing time per month. That was all we could afford as a student.

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #97 on: July 16, 2020, 10:14:28 am »
Do we just use the fpcupdeluxe-arm-linux link or what needs to be done to install this on a pi (or BBB)?
It will work, but it's much better to use fpcupdeluxe-armv6hf-linux on 32bit OS and fpcupdeluxe-aarch64-linux on 64bit OS.

It's poor little single core is usage bar is pinned at 100%.  May take some time...
If I remember well, since last few years you need around 2GB RAM for Lazarus compilation of big IDE with lots of additional components. When lacking physical RAM - swap helped but sloooweed down a loooooot.
« Last Edit: July 16, 2020, 10:32:58 am by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

jcdammeyer

  • Full Member
  • ***
  • Posts: 205
  • Embedded System Developer
    • Automation Artisans Inc.
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #98 on: July 17, 2020, 02:48:25 am »
It's poor little single core is usage bar is pinned at 100%.  May take some time...
If I remember well, since last few years you need around 2GB RAM for Lazarus compilation of big IDE with lots of additional components. When lacking physical RAM - swap helped but sloooweed down a loooooot.

I found the Beagle quite slow after installing the 2GB swap drive.  I tried disabling the swap since it wasn't there before I installed the new Lazarus and found that now it won't compile the project at all.  Perhaps I did something to a swap drive that was there before.  Although plugging in a different stretch SD and doing a sudo swapon -s didn't show one.

What's the general concensus for a swap drive?  Having it on an SD card will kill it in no time so it should be in RAM which will also speed things up.

jcdammeyer

  • Full Member
  • ***
  • Posts: 205
  • Embedded System Developer
    • Automation Artisans Inc.
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #99 on: July 17, 2020, 02:55:57 am »
Quote
I finally bit the bullet and bought an HP ZBook with WIN-10

The thesis poses an interesting programmer starting point: "cafetaria" programming.
For me, 100% true when I was a student and even today !

Long time ago, I started with 1 second mainframe Pascal compiling and executing time per month. That was all we could afford as a student.
This is an interesting article. 
https://community.idera.com/developer-tools/b/blog/posts/c-builder-a-delphi-developer-perspective?utm_source=Eloqua&utm_medium=email&utm_content=Article-cpp200716-delphiperspective
I also have RAD Studio for work-work projects.  The Delphi compiler is still so much faster than Lazarus.  A program 10x the size compiles and is running in 4 seconds.  A much smaller Lazarus program takes 14 seconds.

I did look at the cross compiler features on the windows system. 
Obviously Target OS is Linux
Family is ARM
What processor for Pi3 and which one for Beagle?   Or don't tell me but point me in the direction to find out.  On the Pi and BBB they are listed as default so that didn't really help looking on those Lazarus installations.  The BBB is so painfully slow that I'd rather write the app on the PC and then cross compile for the BBB but perhaps, because of some differences, test and debug on the Pi.

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1738
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #100 on: July 17, 2020, 07:38:32 am »
Quote
What processor for Pi3 and which one for Beagle?
Rpi 3-4 have an ARMV8. Beagle has ARMV7. For Lazarus you may choose aarch64 to compile for ARMV8.

I definitely would like to advice you to look more closely into cross-compiling. Its one of the main super-features of FPC and Lazarus. I myself use strictly layered software design to be able to use cross-compiling. Using USB or I2C as interface, the only debugging on the ARM-system needed is to check this interface. All the rest (main program/business logic [debugging]) can be done on a big and fast Windows or Linux systems.

jcdammeyer

  • Full Member
  • ***
  • Posts: 205
  • Embedded System Developer
    • Automation Artisans Inc.
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #101 on: July 17, 2020, 08:06:26 am »
I definitely would like to advice you to look more closely into cross-compiling.

Thanks.  Much of the work I do with Delphi still revolves around the USB port and talking to dedicated hardware like 9S12X or dsPIC.  Or to CANUSB dongles.  Very big on Controller Area Network.  So often the debugging has to be done on the machine where the hardware lives.

Cross compiling for the RPi brings up an interesting question and one I'll have to try to see what happens.   I have a drop down list that is populated with the list of serial ports.  Once you select a port the OPEN/CLOSE buttons are made visible and the OPEN enabled.  With Windows select the first, second or third and the list retracts, that entry shows up and buttons are enabled. 

On the Pi and Beagle the list drops down.  Click on the 2nd, 3rd or 4th and the list retracts and the entry selected is shown along with the buttons made visible.  But not the first.  After the list retracts you still have to click on the text in the list box before the buttons are made visible. 

Since this happens on both the Beagle and the Pi my guess is it's a Linux Library issue and likely not an ARM issue.  So I imagine cross compiling for the Pi will result in the same problem.

Now I'm not looking for a solution here.  This is the wrong subject heading to deal with this problem.  But if the cross compiler creates the same issue as the one on the Pi while compiling for the PC does not then maybe it is of interest for installation?

Anyway, cross compiling and testing via USB to CAN dongle can be done on both systems and in fact I'm doing that on the PC.  Just so much faster.  But once I start using the Pi HAT with MCP2515 for CAN or the internal CAN on the BBB I'm screwed.  Pretty well have to debug on site.  But 99% of what I'm doing can be done with the USB dongle.


jcdammeyer

  • Full Member
  • ***
  • Posts: 205
  • Embedded System Developer
    • Automation Artisans Inc.
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #102 on: July 17, 2020, 08:43:39 am »
So I set up to cross compile using the aarch64 on the PC.  OS was set to Linux, Processor was default.  I turned debug off so the file wouldn't be huge.

And here's a screen grab of the error.

Do I have to install using fpcupdeluxe with target ARM onto the PC too?  That would make sense.  Of course that hasn't worked on a PC for me yet.

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1738
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #103 on: July 17, 2020, 09:40:53 am »
Now you are in the fpcupdeluxe hotspot.  :D
Do not touch your current install. It works.
Use fpcupdeluxe to make a new install of FPC stable and Lazarus stable. Both these releases are very good. Choose an install location of your choice. After successful install, use fpcupdeluxe again to install the aarch64-linux crosscompiler. After success you are ready to go crossing.
I hope these instructions will work for you.


 

TinyPortal © 2005-2018