problem using ARM cross compiler with classes lazarus / 62-General ---------------------------------------------------------------------- petex · 2025-02-01 13:52 hello, I can cross-compile a simple program for the raspberry pi (linux) using windows pc. If i introduce the unit "Classes" i get an exeption in the initialisation: QuoteAn unhandled exception occurred at $00010D10: EAccessViolation: Access violation this is my program : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program test ;{$define unix}  {$mode objfpc}{$H+} uses   cthreads,   unix,  sysutils,  classes; //var//    parseStrings : TStringList ;begin   writeln('TEST');//  parseStrings := TStringList.Create;  while true do; end. Are there any obvious solutions or things to try before i try and debug it. I don't have a lazarus debugger working with the rpi and presumably i would need to use gdb and backtrace. ---------------------------------------------------------------------- cdbc · 2025-02-01 14:24 Hi Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program test ;{$define unix} //<-- if you compile on linux, mac, unix,// the above gets defined automagically {$mode objfpc}{$H+} uses   cthreads,   ///// unix, ///// not unix, but  baseunix, // <-- if you need it at all...  sysutils,  classes;These corrections should let you compile and get on with it... Regards Benny ---------------------------------------------------------------------- Thaddy · 2025-02-01 14:39 Try it like this (tested):Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program test ;{$mode objfpc}{$H+}uses{$ifdef unix}   cthreads,// automatic{$endif}  classes; var  parseStrings : TStringList ;begin  parseStrings := TStringList.Create;  try    // do someting    parseStrings.Add('TEST');    writeln(parseStrings.text);  finally    parseStrings.Free;  end;  end. ---------------------------------------------------------------------- cdbc · 2025-02-01 14:44 Thanks Thaddy =^ Cannot test - I ain't got no winders. Regards Benny ---------------------------------------------------------------------- petex · 2025-02-01 20:22 The test program (and my program) work on a pi 2 Model B. (that system has the debugger etc so i was going to investigate the crash but discovered it worked ok) I get the exception trying to run it on a pi zero. Both devices have the same operating system version. QuoteEAccessViolation: Access violation   $00010E30   $B6DC1884  I did a command "ldd test" on both machines and get the following: Pi Model B Quotelinux-vdso.so.1 (0x7eefd000)         libpthread.so.0 => /lib/libpthread.so.0 (0x76f50000)         libdl.so.2 => /lib/libdl.so.2 (0x76f20000)         libc.so.6 => /lib/libc.so.6 (0x76db0000)         /lib/ld-linux-armhf.so.3 (0x76f75000) Pi zero W Quotelibpthread.so.0 => /lib/libpthread.so.0 (0xb6f20000)         libdl.so.2 => /lib/libdl.so.2 (0xb6ef0000)         libc.so.6 => /lib/libc.so.6 (0xb6d80000)         /lib/ld-linux-armhf.so.3 (0xb6f4c000) I don't know if this is a red herring, but the difference is "linux- vdso.so.1" and apparently this isn't really a library module. Pi zero  cpu Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i processor     : 0model name      : ARMv6-compatible processor rev 7 (v6l)BogoMIPS        : 697.95Features        : half thumb fastmult vfp edsp java tlsCPU implementer : 0x41CPU architecture: 7CPU variant     : 0x0CPU part        : 0xb76CPU revision    : 7 Hardware        : BCM2835Revision        : 9000c1Serial          : 000000003f115cb7Model           : Raspberry Pi Zero W Rev 1.1 ---------------------------------------------------------------------- Thaddy · 2025-02-02 14:01 the vdso points to the disk overlay over fat32. Should not make a difference. It is a pre-kernel module, needed at start-up only. I tested most, just not the Pi zero W, because I only have Pi zero 2 W's. Also note I ordered but did not receive a 500, but tested 5. Note that if you did not upgrade the OS on anything below the 3 series, you may run into trouble because for those, the initial freepascal support was basically a hack. Only from 3.0.4. Fpc had official armhf support without the hack. I can imagine you have series 1 or 2 running and did not bother to upgrad, but that is really necessary for those models to have proper support. And even the 1 series can be upgraded. Depending on what you want, I would simply keep them running as is and just source a couple of 5's or Pi zero 2 W's. (in my case the older ones run things like pihole and some IoT projects) ---------------------------------------------------------------------- petex · 2025-02-03 15:03 I am not too clear on what you are saying, except that I am basically screwed if i want to cross compile to old hardware with the latest stable (3.2.2) fpc toolset. So if i used version 3.0.2 i could possibly get this working. So would i select 3.0.2 FPC version the the fcupdeluxe page - install the fpc and then install the cross compiler toolset on the next page ? ---------------------------------------------------------------------- Thaddy · 2025-02-03 15:13 No, the other way around. It is not the hardware, it is the software: you need to update Raspbian to Raspberry Pi OS. And the new version works on any Raspberry model. That also has the advantage you can upgrade to fpc 3.2.2 from the repository.