Recent

Author Topic: Cross compile from linux-x86 to linux-arm  (Read 6245 times)

cd

  • Jr. Member
  • **
  • Posts: 54
Cross compile from linux-x86 to linux-arm
« on: January 12, 2018, 05:40:29 pm »
Hello all

I've got a RPi 3B board with linux installed. There I have a working installation of fpc/lazarus, which where built there from sources.

Now I want to build RPi-dedicated executables directly from my laptop with linux x86.

I have built the fpc cross-compiler following the instruction in the wiki http://wiki.lazarus.freepascal.org/Setup_Cross_Compile_For_ARM.

Everything seems to be working, at least the hello-world executable is created without errors and cannot be run under laptop-OS, saying the format is wrong, which means that it is really for arm. But when I transfer executable to RPi and try to run it i get a segmentation fault (sigsegv) without any additional information. Under the gdb there is also no information about the error, the gdb says "During startup program terminated with signal SIGSEGV, Segmentation fault" - and that's all.

Does anyone know how to debug this, cause i'm totally confused?

According to `uname -a` the RPi kernel is for armv7l, which is afaik arm7a+softfloat, so i built  crosscompiler with ARMV7A and SOFT for float operations. But i have also tried other float options and ARM* archs, nothing changed. So it seems that something else is wrong.

Could anyone give any direction for investigation of the problem, i'm out of ideas.

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Cross compile from linux-x86 to linux-arm
« Reply #1 on: January 12, 2018, 06:35:10 pm »
I've got a RPi 3B board with linux installed.

According to `uname -a` the RPi kernel is for armv7l, which is afaik arm7a+softfloat, so i built  crosscompiler with ARMV7A and SOFT for float operations. But i have also tried other float options and ARM* archs, nothing changed. So it seems that something else is wrong.
Are you sure about that ? raspbian hasn't been softfloat for a long time now (so unless you have a veeery old distro).

Have a look at this wiki-page:
Code: [Select]
OS_TARGET=linux CPU_TARGET=arm  CROSSBINDIR=%FPCPATH%/bin/win32-armhf-linux CROSSOPT="-CpARMV6 -CfVFPV2 -OoFASTMATH" FPC=%FPCPATH%/bin/i386-win32/ppc386.exe
OK, it is cross from windows but that doesn't slow down the joy  :)

edit:
Some things that might be of interest:
- How to Check the Software and Hardware Version of a Raspberry Pi
- How can I tell if I am using the hard-float or the soft-float version of Debian/Raspbian?

Someone with the same idea as yours (with answer why it can be confusing)
« Last Edit: January 12, 2018, 07:10:58 pm by molly »

 

TinyPortal © 2005-2018