# [fpc-devel] Porting FPC to IBM zArch

Wed Jul 24 17:54:52 CEST 2013

On 24.07.2013 16:36, Bernd Oppolzer wrote:
> Then I built the RTL for linux, which also worked successfully, as far
> as I saw,
> but when compiling with -Tlinux, I now get the following message:

How did you build it? Building the RTL for Linux should be (assuming
that your FPC source is at c:\fpc)

cd c:\fpc
make crossall CPU_TARGET=i386 OS_TARGET=linux
CROSSBINDIR=C:\path\to\linux\binutils BINUTILSPREFIX=i386-linux-

BINUTILSPREFIX could also be something different or empty (then the
option should be "BINUTILSPREFIX="), it depends on how your

Once that worked you can install the compiler using

make crossinstall CPU_TARGET=i386 OS_TARGET=linux
INSTALL_PREFIX=c:\wherever\fpc\should\be\installed

You should do a

make all install INSTALL_PREFIX=c:\wherever\fpc\should\be\installed

at first though. You'll also need to adjust a configuration for your new
compiler (simplest approach is to copy the fpc.cfg from
c:\whereever\fpc\2.6.2\bin\i386-win32\fpc.cfg to

>
> C:\fpc_test>ppc386 -Tlinux pasform.pas
> Free Pascal Compiler version 2.7.1 [2013/07/24] for i386
> Copyright (c) 1993-2013 by Florian Klaempfl and others
> Target OS: Linux for i386
> Compiling pasform.pas
> PPU Invalid Version 135
> Fatal: Can't find unit system used by PASFORM
> Fatal: Compilation aborted
>
> that is: the system.ppu seems to be found, but there is something wrong
> with the version.

You compiled the RTL using the 2.6.2 compiler, not the 2.7.1 compiler.
The PPU version of 2.7.1 is already > 160.

> When trying to build the RTL for OS/2 (running make in the os2 subdir of
> fpc/rtl), I get the following messages:
>
> C:\fpc\rtl\os2>make

This is wrong. You need to build at the toplevel which is c:\fpc\rtl.
Everything else is not officially supported and not recommended for a
beginner (no offence).

(Note: You'd need to pass the path to the new compiler otherwise it will
just use "fpc" or "ppc386" which will use your installed fpc; this can
be done using the FPC option like this:

make clean all FPC=c:\wherever\ppc386.exe

)

> C:/lazarus/fpc/2.6.2/bin/i386-win32/gmkdir.exe -p ../../rtl/units/os2
> i386-os2-as -o ../../rtl/units/os2/prt0.o prt0.as
> process_begin: CreateProcess((null), i386-os2-as -o
> ../../rtl/units/os2/prt0.o p
> rt0.as, ...) failed.
> make (e=2): Das System kann die angegebene Datei nicht finden.
> make: *** [prt0.o] Error 2
>
> apparently, there is no i386-os2-as

You'll need to either find binary assembler and linker for OS/2 or build
it yourself. As I don't normally cross compile to OS/2 I can't help you
here.

>
> when I did the same thing in the linux subdir, it worked (but: see above).
>
> Do I need a special ASSEMBLER to build the OS/2 RTL?
>

You could try to use the RTL provided with the native OS/2 package, but
you'd still need an assembler and linker to compile a program.

> No need to invest much time in those questions: I already had some
> insights in the techniques of cross-compiling ... and in any case I'm
> now able
> to build a new compiler from the compiler sources.

Regards,
Sven

PS: Please don't post at the top, but at least answer below the previous
mail or better use inline answers (like I did here). Thank you.