Recent

Author Topic: Building the FPC cross-compiler from AArch64 linux to x86_64 linux  (Read 323 times)

RicknM

  • Newbie
  • Posts: 1
Hi,

I am trying to build the fpc cross-compiler from AArch64 linux to x86_64 linux.
But it does not work.
(Building the cross-compiler from AArch64 linux to x86_64 win64 works)

My system:
AArch64
Ubuntu Mate 20.04.3 LTS

Fpc: 3.2.2
Lazarus: 3.8

These are the steps I did:

1.) Download and install fpc-3.2.2.aarch64-linux.tar

2.) Download fpc-3.2.2.source.tar.gz and create folders and copy sources to /usr/share/fpcsrc/3.2.2

3.) sudo -i
4.) export FPCVER="3.2.2"
5.) cd "/usr/share/fpcsrc/${FPCVER}"
6.) make clean all OS_TARGET=linux CPU_TARGET=x86_64

which leads to the following error:
x86_64-linux-as --64 -o /usr/share/fpcsrc/3.2.2/rtl/units/x86_64-linux/prt0.o x86_64/prt0.as
make[5]: x86_64-linux-as: Command not found
make[5]: *** [Makefile:3799: prt0.o] Error 127
make[5]: Leaving directory '/usr/share/fpcsrc/3.2.2/rtl/linux'
make[4]: *** [Makefile:2037: linux_all] Error 2
make[4]: Leaving directory '/usr/share/fpcsrc/3.2.2/rtl'
make[3]: *** [Makefile:4470: rtl] Error 2
make[3]: Leaving directory '/usr/share/fpcsrc/3.2.2/compiler'
make[2]: *** [Makefile:4386: cycle] Error 2
make[2]: Leaving directory '/usr/share/fpcsrc/3.2.2/compiler'
make[1]: *** [Makefile:2800: compiler_cycle] Error 2
make[1]: Leaving directory '/usr/share/fpcsrc/3.2.2'
make: *** [Makefile:2832: build-stamp.x86_64-linux] Error 2

So I updated/installed the following packages:
7.) sudo apt-get install binutils binutils-x86-64-linux-gnu gcc-x86-64-linux-gnu

8.) ln -sf /usr/bin/x86_64-linux-gnu-as /usr/bin/x86_64-linux-as

9.) make clean all OS_TARGET=linux CPU_TARGET=x86_64
which leads to following error:
system.pp(490,1) Fatal: Internal error 2015030501
Fatal: Compilation aborted
make[5]: *** [Makefile:3848: system.ppu] Error 1
make[5]: Leaving directory '/usr/share/fpcsrc/3.2.2/rtl/linux'
make[4]: *** [Makefile:2037: linux_all] Error 2
make[4]: Leaving directory '/usr/share/fpcsrc/3.2.2/rtl'
make[3]: *** [Makefile:4470: rtl] Error 2
make[3]: Leaving directory '/usr/share/fpcsrc/3.2.2/compiler'
make[2]: *** [Makefile:4386: cycle] Error 2
make[2]: Leaving directory '/usr/share/fpcsrc/3.2.2/compiler'
make[1]: *** [Makefile:2800: compiler_cycle] Error 2
make[1]: Leaving directory '/usr/share/fpcsrc/3.2.2'
make: *** [Makefile:2832: build-stamp.x86_64-linux] Error 2

Any ideas?

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12107
  • FPC developer.
Re: Building the FPC cross-compiler from AArch64 linux to x86_64 linux
« Reply #1 on: February 08, 2025, 07:09:09 pm »
You need cross binutils. (arm binaries as and ld that can create binaries for x86_64 systems).

These are not part of the FPC distribution, you need to compile them yourself, or see if your distro provides them somehow.

Windows works because for x86/x86_64 windows targets, FPC has the assembler and linker built in.

 

TinyPortal © 2005-2018