tags:

views:

305

answers:

4

I want to build a command-line tool in FPC for run in a Suse 9.

This is a production server and is hard get aproved to install anything apart this tool.

I code on Leopard and wonder if is possible cross-compile from here to linux.

The server run on Xeon.

+1  A: 

Unless there are cross-compilation options I can't find, you're probably out of luck doing it directly from OS/X. However, you can get what you want by installing a virtual machine like Parallels or Sun's VirtualBox, installing SuSE on it, and compiling there.

Charlie Martin
+3  A: 

Success! If you install Fink and then say

sudo fink install fpc-i386-linux

it will install fpc and everything you need to cross compile. You will then be able to say

/sw/bin/fpc -Tlinux hw.pas

and get a Linux executable.

Chas. Owens
A: 

FPC can crosscompile pretty well in general. There are limitations though:

  1. Crosscompiling from a non x86/x86_64 architecture to x86/x86_64 won't work. It requires extended, which isn't emulated on other archs. However you seem to use an intel OS X machine (not PPC), so that doesn't apply.
  2. Depending on the libraries used and the nature of the target platforms you might need to have target-libraries on host. (in general: not for windows, but you will have to for *nix/OS X as target)

See also http://www.stack.nl/~marcov/buildfaq.pdf it contains some background on crosscompiling with FPC.

Marco van de Voort
A: 

There are now .dmg files of FreePascal (Binary, source, and LAzarus) available for install, so it should be easy to install, open, and compile it. Note, though, that if it links to linux-specific .so files, that they may need to be installed on Mac OS, or you will have to change the code not to use them.

Noah