[fpc-devel] Porting FPC to IBM zArch

Tomas Hajny XHajT03 at hajny.biz
Thu Jul 25 14:53:17 CEST 2013

On Wed, July 24, 2013 16:36, Bernd Oppolzer wrote:

Hello Bernd,

> Free Pascal Compiler version 2.7.1 [2013/07/24] for i386
> Copyright (c) 1993-2013 by Florian Klaempfl an
> 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
> 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.

First of all - I'm maintainer of the OS/2 target in FPC, but I'm on
vacation now (until end of this week) and thus somewhat slower in reading
and replying e-mails and also limited due to having no PC (and no
electricity ;-) ) around.

Now to your questions: OS/2 RTL (and compiler, text mode IDE, etc.), are
obviously available for download and installation (primarily under OS/2,
but there are ways how to use and unpack this package on other platforms -
MS Windows would be probably the easiest one due to using the same
directory structure (different on Unix targets) and ability to run the
GO32v2 (aka DOS) installer which can install the OS/2 releases too. One
important caveat in this case - OS/2 releases use the short version of
target (only "os2" instead of "i386-os2", "win32" instead of "i386-win32",
etc.), in order to allow use of FPC also with OS/2 installed on FAT-16.
This means that you need to rename directory "units\os2" to
"units\i386-os2" or create a NTFS symlink accordingly when trying to use
the Win32 compiler targetting to OS/2. Obviously, you need to use the
2.6.2 compiler when using the 2.6.2 pre-compiled RTL.

Another caveat - cross-compilation to os2 target are somewhat complicated
by missing internal assembler and linker for the OS/2 target and the
arcane version of GNU tools (especially the linker and GDB which are only
available in the special EMX version derived from GNU binutils version 2.6
long time ago and never merged into the mainstream GNU tree).
Cross-compiled binutils exist for the Win32 platform - coming from the RSX
NT port if it tells you something. These are available on our FTP server
in directory "contrib" (together with cross-binutils for other

However, the included assembler does not support some newer opcodes and
this makes building the FPC RTL impossible with this assembler (a newer
port of GNU assembler to OS/2 is available and included with FPC - unlike
LD and GDB. This version of GNU assembler featuring the EMX a.out format
necessary for the EMX/RSX linker and GDB might be possibly built for Win32
too, but I'm not aware of pre-built binaries.

Cross-debugging from Lazarus would probably not work either (remember the
legacy GDB version) - GDB and PMGDB as included with the OS/2 release need
to be used for debugging of OS/2 binaries compiled with FPC.

I can imagine that using OS/2 for cross-compiling to potential future
zArch target due to out of the box support of EBCDIC character set in OS/2
(once I finish the OS/2 widestring/unicodestring manager ;-) ) and I'm
willing to help you with any potential obstacles with the os2 target as
much as possible.

Hope this helps


More information about the fpc-devel mailing list