[fpc-pascal] Crosscompile FPC from Win32 to Linux

David Emerson dle3ab at angelbase.com
Fri Jun 4 20:13:01 CEST 2010


Andreas Berger 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?

I haven't ever cross-compiled anything, but here's a start...

Looking here:
http://wiki.lazarus.freepascal.org/Cross_compiling
http://wiki.lazarus.freepascal.org/Cross_compiling#To_Linux_2

...it looks like it may be tricky to do win->linux. I am guessing it is 
possible... hopefully someone more knowledgeable will give you some tips on 
this list... and perhaps the wiki will get fleshed out some day.

> or is it easier to learn how to use linux and do it there?

honestly, this may be the easiest option.

If you have ssh access to the web host and an fp compiler is (or can be) 
installed there, then you could just upload your sources to the host and 
compile them there. Check out putty or ttssh.

Alternately you could just install linux on a machine somewhere, or if that's 
tricky, install virtualbox with a linux guest and use that.

> I saw a page how to crosscompile lazarus, but it seamed very complex.

Well, lazarus is very complex, so cross compiling it will be complex. Your 
program will probably be easier to cross compile if it does not use so many of 
fpc's and LCL's capabilities and libraries.

> P.S. fp.exe lets you select a linux output, but it doesn't work.

probably because some other stuff needs to be configured, some of which is noted 
in the cross compiling wiki instructions above.

~David.




More information about the fpc-pascal mailing list