[fpc-pascal] Cross-compilation to Linux from win32

Michael.VanCanneyt at Wisa.be Michael.VanCanneyt at Wisa.be
Sat Jan 15 12:30:38 CET 2005

On Fri, 14 Jan 2005, Simon Kissel wrote:

> Hi,
> after quite some time I thought to give FPC another try to see if it's
> a suitable replacement for Kylix.
> My goal is to be able to cross-compile Linux elf targets from win32.
> So I downloaded and installed 1.9.6, and after that added the units
> packages for Linux.
> Run up FP, compiled hello world, worked. Switched the target in FP to
> linux, compiled again - and wow, it also worked. Using the verbose
> output I could even see it using the Linux units etc. All fine.
> Until I examined the generated executable "hello". It looks like it's
> a Linux binary packed into a PE file. Very weird. Doesn't run under
> Linux of course, and does nothing under Windows.
> Next attempt was to use fpc directly:
> C:\pp\demo\text>fpc -Aelf hello.pp
> Free Pascal Compiler version 1.9.6 [2004/12/31] for i386
> Copyright (c) 1993-2004 by Florian Klaempfl
> Target OS: Win32 for i386
> Compiling hello.pp
> Linking hello.exe
> 31 Lines compiled, 0.4 sec
> Well, no.
> Some advise on what to do would be very welcome.

You can't do it using linux alone.

You must install cross-target binutils. Specifically: the linker must 
create a linux binary instead of a Windows binary.

Once you have those installed (there is a zip floating around somewhere)
you must point the compiler to them with the -FD parameter.


More information about the fpc-pascal mailing list