Recent

Author Topic: Lazarus on aarch64 systems like Odroid-C2 (and RPi3)  (Read 22418 times)

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1146
Lazarus on aarch64 systems like Odroid-C2 (and RPi3)
« on: March 24, 2016, 06:37:06 am »
In this thread you can collect your experiences with running FPC and Lazarus on Linux Aarch64 systems.

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1146
Re: Lazarus on aarch64 systems like Odroid-C2 (and RPi3)
« Reply #1 on: March 24, 2016, 06:41:08 am »
@Rich
I am going to install Ubuntu Mate 16.04 on my Odroid-C2, because a working debugger is very much needed in this case.
Will keep you informed. Perhaps also need some help: I have never used Ubuntu before.

criageek

  • Jr. Member
  • **
  • Posts: 79
Re: Lazarus on aarch64 systems like Odroid-C2 (and RPi3)
« Reply #2 on: March 24, 2016, 02:04:48 pm »
Hello again DonAlfredo!  I got your message that your debugger still fails in Ubuntu  :(  I can't think of anything I've done that might be out of the ordinary that would make my debugger work.  Did you do all the updates to Ubuntu before trying to install Lazarus?

sudo apt-get update
sudo apt-get upgrade

One thing to remember is that Ubuntu 16.04 has not yet been released.  Ubuntu has a new release every 6 months, in October and April.  The version numbers correspond to the release date.  So 16.04 corresponds to 2016, 4th month.  But that doesn't explain why the debugger works on my install.

The only thing I can think of is the sd card.  I've read about some people having trouble with certain sd cards and that you want to use  a class 10.  Mine is a 32gb class 10.  But really, if the install went ok I can't see that being the problem.

I'll make another post right after this one with the issues I'm having so far.

Rich

criageek

  • Jr. Member
  • **
  • Posts: 79
Re: Lazarus on aarch64 systems like Odroid-C2 (and RPi3)
« Reply #3 on: March 24, 2016, 02:17:39 pm »
Here are the major issues I've seen so far:

Toolbars - Anywhere that a toolbar is used in the IDE, only the right-most button can be pressed.  I've duplicated this behavior in a simple app of my own.  I got around the problem on the Package Editor by moving the 'Use' button to the far right so I could use it to install packages.

Cursor moves to top of Source Editor window - Anytime I press 'Enter' the cursor moves to the top of the Source Editor window and all the way to the right.  This also happens when debugging after I use F7 or F8 to step Step Into or Step Over.

Range Check Error - This pops up frequently.  Clicking 'OK' to continue 'seems' to be ok most of the time, but it's annoying.  I can always make it appear by trying to open a Lazarus source file, such as toolbutton.inc.

Source Editor blank - Sometimes after opening a file in the Source Editor, the window will be blank.  I can usually get around this by opening the file from the Project Inspector.  Although it's always blank after opening a Lazarus source file (like toolbutton.inc) and clicking 'OK' on the Range Check Error.

IDE resized - At some point late last night my IDE resized itself (see attachment) and I've been unable to resize it myself.

All for now!  Happy Odroiding!

Rich
« Last Edit: March 24, 2016, 02:19:23 pm by criageek »

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1146
Re: Lazarus on aarch64 systems like Odroid-C2 (and RPi3)
« Reply #4 on: March 24, 2016, 02:26:39 pm »
Thanks for the report.

I have updated one of the Odroid bugreports:
http://bugs.freepascal.org/view.php?id=29874
http://forum.odroid.com/viewtopic.php?f=136&t=19073

Seems that a very new kernel is needed for gdb to work correctly.

If the debugger works again, the real debugging can start !

ps:
I have installed Ubuntu.
Looks great.
Running uname -r gives 3.14.29-29

criageek

  • Jr. Member
  • **
  • Posts: 79
Re: Lazarus on aarch64 systems like Odroid-C2 (and RPi3)
« Reply #5 on: March 24, 2016, 02:31:41 pm »
Mine is 3.14.29-37

Rich

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1146
Re: Lazarus on aarch64 systems like Odroid-C2 (and RPi3)
« Reply #6 on: March 24, 2016, 02:33:02 pm »
Well ... there is your proof !
I will try to update/upgrade !

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1146
Re: Lazarus on aarch64 systems like Odroid-C2 (and RPi3)
« Reply #7 on: March 24, 2016, 04:33:25 pm »
Debugging has started !

Range check errors in source window are caused by (line 3315 of synedit.pp):

i := GetWheelScrollAmount(LinesInWindow);

Why ?!!

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3645
  • I like bugs.
Re: Lazarus on aarch64 systems like Odroid-C2 (and RPi3)
« Reply #8 on: March 24, 2016, 04:48:27 pm »
How did you guys test GDB? Is it not working even from console using a simple test program?
Its behavior under Lazarus is another issue. There some complex IPC is needed.
However if this is about the issue explained ODROID forum and it can be cured with a recent kernel, then things look good. I will not use time for invertigating it.

I was testing DonAlfredo's Odroid C2 through VNC. You mentioned that building Lazarus "Debug IDE" failed due to lack of memory. How is it possible as Odroid C2 has 2 GB memory? How much of it is used by GPU? How much more memory is needed for 64-bit operation versus 32-bit operation?
Anyway it feels strange. I have built and used Lazarus in a Pentium II machine with 384 MB memory. IIRC the total used memory with swap was below 1 GB at all times.

Some of the problems can come from buggy libraries. I read warnings about it. This ARM 64-bit architechture is new and lots of code is still buggy. I believe things will improve quickly because Odroid C2 and Raspberry Pi 3 have lots of testers.

From an earlier thread:
So I guess reports are NOT welcome in the bug tracker...

Reports about an alpha quality feature are not welcome. There must be some level of stability before reporting bugs makes sense.
For example DonAlfredo's debugger report does not belong to Lazarus bug tracker, it belongs to Odroid bug tracker instead.
Other bugs may be caused by some library, too, nobody knows yet.
One bug report saying "Lazarus is broken on aarch64 systems" would be enough but even that is useless because I knew about it already, and I am the only Lazarus developer who tested the issue after communicating with DonAlfredo.

The same is true with other alpha quality features like GTK3 bindings. A person who wants to improve it does not need bug reports because the missing things are so obvious. Lazarus IDE cannot be built with it for example.
« Last Edit: March 24, 2016, 05:14:39 pm by JuhaManninen »

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1146
Re: Lazarus on aarch64 systems like Odroid-C2 (and RPi3)
« Reply #9 on: March 24, 2016, 05:01:26 pm »
@juha.

Understood ! About (too many) bug reports: that is the reason for this thread !!

Debugger:
GDB is working with latest Ubuntu kernel (see bugtracker update). So don't put time in it !! Just have a quick look at the patch.
I had to drop Arch for now, due to this kernel problem. Ubuntu is ok !
Message on Arch forum : https://archlinuxarm.org/forum/viewtopic.php?f=65&t=10045
If Arch is ok, I will switch back and enable remote access again.

Memory:
In my experience, building Lazarus on any arm system has always consumed huge amounts of memory.
Strange compile problems could often be solved by adding (swap) memory.
I did not investigate this further. Just increased swap and "voila".

Now:
Tracing many more range check errors, in places that I do not understand !
Newest: BalanceNode(P); (line 1426 of SynEditHighlighterFoldBase.pas).


criageek

  • Jr. Member
  • **
  • Posts: 79
Re: Lazarus on aarch64 systems like Odroid-C2 (and RPi3)
« Reply #10 on: March 24, 2016, 05:23:24 pm »
Thanks for the feedback JuhaManninen!  As a virgin bug reporter I did not know the guidelines when I reported aarch64 issues, but I will learn!

As for swap size needed to compile Lazarus, I tried with 256mb and it failed, so I bumped it up to 1gb and then it worked.

Rich

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3645
  • I like bugs.
Re: Lazarus on aarch64 systems like Odroid-C2 (and RPi3)
« Reply #11 on: March 24, 2016, 05:26:51 pm »
Range check errors in source window are caused by (line 3315 of synedit.pp):
i := GetWheelScrollAmount(LinesInWindow);
Why ?!!

It may come from inside GetWheelScrollAmount but GDB shows it inaccurately. I have seen similar cases.
Normally I debug Lazarus using another Lazarus instance. It works well but requires lots of memory. It may not be possible in this Odroid gadget.
I have not used GDB directly for setting breakpoint nor stepping in code for many years. Maybe I should learn again how to do it.

Q: How stable is FPC in aarch64? Does it have known bugs?
Q2: Are FPC + Lazarus in ARM 32-bit systems as stable as in Intel systems?

criageek

  • Jr. Member
  • **
  • Posts: 79
Re: Lazarus on aarch64 systems like Odroid-C2 (and RPi3)
« Reply #12 on: March 24, 2016, 05:32:42 pm »
As for Q2:  I have been using Lazarus on my Raspberry Pi2 Model B for several months and have seen no issues at all.

Rich

criageek

  • Jr. Member
  • **
  • Posts: 79
Re: Lazarus on aarch64 systems like Odroid-C2 (and RPi3)
« Reply #13 on: March 24, 2016, 07:56:23 pm »
I found a work-around for my main ide window size problem.  I edited ~/development/config_lazarus/environmentoptions.xml

In the MainIDE section I changed the value of the WindowState setting to 'Normal'.

Rich

criageek

  • Jr. Member
  • **
  • Posts: 79
Re: Lazarus on aarch64 systems like Odroid-C2 (and RPi3)
« Reply #14 on: March 24, 2016, 10:50:53 pm »
I *think* I've found a workaround for the Range Check Errors when scrolling with the mouse wheel in the Source Editor.  In synedit.pp, in function GetWheelScrollAmount, I changed all instances of the Inc command and all instances of the Dec command to remove these commands.  So for instance, I changed

Inc(FMouseWheelAccumulator, AnInfo.WheelDelta);

to

FMouseWheelAccumulator := FMouseWheelAccumulator + AnInfo.WheelDelta;

I then rebuilt Lazarus.  I've not seen any Range Check Errors since then when using the mouse wheel to scroll.

Rich