[fpc-devel] AArch64 -> ARM cross compilation

Sven Barth pascaldragon at googlemail.com
Sat Nov 14 17:07:32 CET 2020


Am 14.11.2020 um 15:12 schrieb J. Gareth Moreton via fpc-devel:
> Hi everyone,
>
> I need a little bit of assistance so I can stamp out these bugs for you.
>
> As silly as this sounds, I've mislaid my Arm-32 SD card so I have to develop on AArch64 exclusively on the Raspberry Pi.  As a result I only have the AArch64 implementation of FPC installed.  Is there a way to cross-
> compile AArch64 to Arm, or better, install an Arm version of FPC alongside my AArch64 version?  I gather it's not quite as simple as running i386 on x86_64.  Admittedly my expertise with Linux is still lacking a bit,
> especially when it comes to getting the right software installed.
>
> Gareth aka. Kit
>
> P.S. Trying to run "make clean all CPU_TARGET=arm" doesn't seem to work properly - gcc returns errors (doesn't recognise "-m64") and CPU_TARGET seems to get reset back to aarch64.
> P.P.S. If I find my Arm-32 SD card again, I'll probably switch back to that for the testing and debugging.

You need to install arm-linux binutils (don't know what the package is 
called) and then you need to invoke make like this:

make all CPU_TARGET=arm BINUTILSPREFIX=arm-linux- FPMAKEOPT="-T 4" -j 4

Note 1: don't use "clean" and "all" together with parallel compilation 
(the "-j 4")

Note 2: your prefix might be different, e.g. arm-linux-gnueabi- or 
something like that. Best try to execute as/ld using tab completion in 
the shell.

In theory it should also be possible to run 32-bit ARM applications on 
AArch64 though I have not tested that yet.

Regards,
Sven


More information about the fpc-devel mailing list