[fpc-pascal] Crosscompile FPC from Win32 to Linux

Henry Vermaak henry.vermaak at gmail.com
Sat Jun 5 01:47:40 CEST 2010


On 4 June 2010 17:55, Andreas Berger <Andreas at thebergerclan.org> wrote:
> I have a stable cgi program running in windows (no libraries - simple
> writeln). However, our web host is in linux. Is there a simple way for me to
> cross-compile the app? or is it easier to learn how to use linux and do it
> there? I saw a page how to crosscompile lazarus, but it seamed very complex.
>
> P.S. fp.exe lets you select a linux output, but it doesn't work.

It's possible, but it's not really simple.  Some steps:

get cygwin
install some stuff like gcc, flex, bison, binutils-source, iconv
configure binutils with --target i386-linux and --prefix ~/somewhere
open bottle of wine
build binutils
drink bottle of wine (essential step)
binutils will be finished building now and you should have
i386-linux-* in prefix/bin
build fpc rtl and packages with OS_TARGET=linux, making sure you your
new cross binutils are on the path
(learn that fpc cygwin.dll isn't compatible with i386-linux-ld, copy
dll around and shuffle path)
???
profit!

It may be better building the whole compiler for the latest version of
cygwin, but I'll see if I can scrape together the necessary files you
can drop into your fpc bin directory for this to work (not that many).
 I managed to get a simple writeln app to cross compile and run on
linux.

Henry



More information about the fpc-pascal mailing list