Recent

Author Topic: [BUG] LCL on Kindle (arm eabi CPU)  (Read 6687 times)

mercury

  • Full Member
  • ***
  • Posts: 154
[BUG] LCL on Kindle (arm eabi CPU)
« on: September 27, 2016, 03:37:47 pm »
Maybe I'm the first one to try run LCL on kindle in this forum, I mean that E-ink reader.
Well, I followed the wiki ( wiki.lazarus.freepascal.org/Setup_Cross_Compile_For_ARM ).
Actually the guide is not working for kindle without some mod.
Here is what I did (using msys):
Code: Pascal  [Select][+][-]
  1. cd /home/binutils-2.24
  2. ./configure --target=arm-linux-gnueabi --disable-werror
  3. make
  4. make install
copy the bin to “C:\MinGW\msys\1.0\home\fpc\binutils”, and rename to “ar”, “ld”,“as”.
Code: Pascal  [Select][+][-]
  1. cd C:\MinGW\msys\1.0\home\fpc\
  2. set path=C:\MinGW\msys\1.0\home\fpc\bin\i386-win32\;%path%
  3. make crossinstall CPU_TARGET=arm OS_TARGET=linux CROSSBINDIR=C:\MinGW\msys\1.0\home\fpc\binutils OPT=-dFPC_ARMEL INSTALL_PREFIX=C:\MinGW\msys\1.0\home CROSSOPT="-CpARMV7A -CfVFPV3"
add these to fpc.cfg
Code: Pascal  [Select][+][-]
  1. #IFDEF CPUARM
  2. -CpARMV7A
  3. -CfVFPV3
  4. #ENDIF
Kindle use GTK2 and the title should be like this ->
http://wiki.mobileread.com/wiki/Running_X_apps_on_Kindle_Touch
Copy the lib form Kindle to computer through USBNetwork.

Finally the FPC can compile for Kindle.

Well, GTK is working. I should post a screenshot here, unfortunately I don’t why I can’t make a screenshot at that state.
You can download my source and bin file below and try, a jailbreaked Kindle is needed.

Now the problem is LCL is not working. Here is the output run from kindle-xterm:
Code: Pascal  [Select][+][-]
  1. [FORMS.PP] ExceptionOccurred
  2.   Sender=EStringListError
  3.   Exception=String list does not allow duplicates
  4.   Stack trace:
  5.   $0004FDE4
  6.   $0014EB70
  7.   $0019BF38
  8.   $0013FB0C
  9.   $00131A90
  10.   $0014356C
  11.   $0002C470
  12.   $0002F218
  13.   $00192644
  14.   $0003B7A4
  15. TApplication.HandleException String list does not allow duplicates
  16.   Stack trace:
  17.   $0004FDE4
  18.   $0014EB70
  19.   ......
I really hope LCL can work on Kindle.
Any ideas? Thank you very much.
« Last Edit: September 27, 2016, 03:39:49 pm by mercury »

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: [BUG] LCL on Kindle (arm eabi CPU)
« Reply #1 on: September 27, 2016, 04:38:08 pm »
It is very bad practise to rename your cross binutils to their short names.
There are other options for that, in your case:
Code: Pascal  [Select][+][-]
  1. //add to make options:
  2. BINUTILSDIR=</the.path/to/the/binutils/   BINUTILSPREFIX=arm-linux-gnueabi-
  3.  
Note the last "-" is important.
This is because ar, as, ld etc will clash with the native platform ones that mingw already installs.
The short names are for the native platform, the long names with the prefix are for cross-compiling.

Compiling your own code has similar prefixes on the command line: -FD</binutilspath> -XP<the_bin_utils_prefix>
« Last Edit: September 27, 2016, 04:42:00 pm by Thaddy »
Specialize a type, not a var.

mercury

  • Full Member
  • ***
  • Posts: 154
Re: [BUG] LCL on Kindle (arm eabi CPU)
« Reply #2 on: September 28, 2016, 05:17:39 am »
It is very bad practise to rename your cross binutils to their short names.

I don't think it's really matter. Here is what wiki wrote.
Quote
ln -s /usr/local/bin/arm-linux-ar ~/lazarus/fpc/binutils/ar
ln -s /usr/local/bin/arm-linux-ld ~/lazarus/fpc/binutils/ld
Anyway the Kindle-test-GTK is working.

I wonder what this means. And how to make LCL working.
Quote
Sender=EStringListError
Exception=String list does not allow duplicates
Thank you very much.

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: [BUG] LCL on Kindle (arm eabi CPU)
« Reply #3 on: September 28, 2016, 05:30:58 am »
I wonder what this means. And how to make LCL working.
Quote
Sender=EStringListError
Exception=String list does not allow duplicates
Thank you very much.
Documentation says that TStringlist.duplicates is of type tduplicates and reads about this error:
Quote
dupError
  Raise an error when an attempt is made to add a duplicate.

mercury

  • Full Member
  • ***
  • Posts: 154
Re: [BUG] LCL on Kindle (arm eabi CPU)
« Reply #4 on: September 28, 2016, 05:35:07 am »
How to fix it?

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: [BUG] LCL on Kindle (arm eabi CPU)
« Reply #5 on: September 28, 2016, 05:46:47 am »
what application is generating that error ?

Try to compile with debug and -gl for lineinfo to get a better stacktrace.

mercury

  • Full Member
  • ***
  • Posts: 154
Re: [BUG] LCL on Kindle (arm eabi CPU)
« Reply #6 on: September 28, 2016, 07:14:28 am »
what application is generating that error ?
Please see Kindle-test-LCL-src.7z

Try to compile with debug and -gl for lineinfo to get a better stacktrace.
Yes, I did. But on Kindle, it doesn’t output like "$12345678 line 123 of unit1.pas".

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: [BUG] LCL on Kindle (arm eabi CPU)
« Reply #7 on: September 28, 2016, 07:59:53 am »
Please see Kindle-test-LCL-src.7z
Ok, thank you. In that case things went wrong inside LCL.

Yes, I did. But on Kindle, it doesn’t output like "$12345678 line 123 of unit1.pas".
(cross)compile LCL in similar fashion, then your application again. Make sure to _not_ optimize and _not_ strip. Cross fingers for the exe to be small enough to be able to run :-)

The only extra defines i know of are VerboseLCL and DebugLCLComponents, use that for lcl compilation as well. But, afaik these are enabled when compiled in debug-mode by default (please someone correct in case wrong).

mercury

  • Full Member
  • ***
  • Posts: 154
Re: [BUG] LCL on Kindle (arm eabi CPU)
« Reply #8 on: September 28, 2016, 08:30:18 am »
(cross)compile LCL in similar fashion, then your application again. Make sure to _not_ optimize and _not_ strip. Cross fingers for the exe to be small enough to be able to run :-)
Of course, the bin is 24MB. I took a photo, see the attachment.
And what is “Cross fingers”?

The only extra defines i know of are VerboseLCL and DebugLCLComponents, use that for lcl compilation as well. But, afaik these are enabled when compiled in debug-mode by default (please someone correct in case wrong).
How to use these extra defines?
Thank you very much.

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: [BUG] LCL on Kindle (arm eabi CPU)
« Reply #9 on: September 28, 2016, 08:39:29 am »
And what is “Cross fingers”?
Well, besides being an music album made by de band "Architecture in Helsinki" it is an hand gesture, also phrased to wish some-one luck. wikipedia.

Quote
How to use these extra defines?
If you want to manually define them use -dNameOfDefine1 -dNameOfDefine2 -dNameOfDefine3 etc. It is simply another compiler option.

Problem is that i have no clue as of where debugln statements are being outputted on your kindle device :-/

mercury

  • Full Member
  • ***
  • Posts: 154
Re: [BUG] LCL on Kindle (arm eabi CPU)
« Reply #10 on: September 28, 2016, 09:04:04 am »
Well, besides being an music album made by de band "Architecture in Helsinki" it is an hand gesture, also phrased to wish some-one luck. wikipedia.
My poor English. (-_-)

I add -dDebugLCLComponents, then it doesn't compile. (QAQ)
Code: Pascal  [Select][+][-]
  1. gtk2wsbuttons.pp(194,47) Error: Identifier not found "dbgsName"

Is that LCL works on Raspberry Pi? Although I don’t have an arm board. I think their CPU have the same architecture. They should be similar.

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: [BUG] LCL on Kindle (arm eabi CPU)
« Reply #11 on: September 28, 2016, 09:24:48 am »
I add -dDebugLCLComponents, then it doesn't compile. (QAQ)
Code: Pascal  [Select][+][-]
  1. gtk2wsbuttons.pp(194,47) Error: Identifier not found "dbgsName"
Hmz.. maybe you can try adding the define "WithOldDebugln" (without the quotes) and see if that helps ?

Quote
Is that LCL works on Raspberry Pi? Although I don’t have an arm board. I think their CPU have the same architecture. They should be similar.
LCL should work on the pi, see here but, there are some reports concerning pi and lazarus/lcl inside bugtracker.

mercury

  • Full Member
  • ***
  • Posts: 154
Re: [BUG] LCL on Kindle (arm eabi CPU)
« Reply #12 on: September 28, 2016, 09:44:09 am »
Hmz.. maybe you can try adding the define "WithOldDebugln" (without the quotes) and see if that helps ?
The result bin is totally same.

Is there any way to remote debug? Through Wi-Fi, like Android.

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: [BUG] LCL on Kindle (arm eabi CPU)
« Reply #13 on: September 28, 2016, 09:57:13 am »
The result bin is totally same.
In that case, there should be a logfile named "lcldebug.log" somewhere when you run your application on your kindle.

afaik debuglog is controlled with lazlogger, see also here.

Quote
Is there any way to remote debug? Through Wi-Fi, like Android.
Sure, with gdb. See also here (seems not entirely completed documentation).

But, in all honesty. I'm not an expert on lazarus, let alone know anything about gtk2 widgetset.

Perhaps someone else reading this has an idea or two that might be able to help you out (in a better way then i was able to so far)

 

TinyPortal © 2005-2018