[fpc-pascal]Cross-Compiling Debian/Linux -> FreeBSD

Marco van de Voort marcov at stack.nl
Wed Oct 8 14:35:37 CEST 2003

> On Wed, Oct 08, 2003 at 11:02:45AM +0200, Marco van de Voort wrote:
> > > doing (using a shell account), to cross-compile from Debian/Linux to
> > > FreeBSD ?
> > 
> > There are certainly ways, and you are in luck, I just did this last weekend.
> > I'm writing an article about it for a German magazine, and am very
> > interested how doable it is for a  common user.
> > 
> > It is not hard. I generated linux and freebsd binaries on windows
> > 
> > Some questions first:
> > - Is your binary pure FPC, or does it link to C? If it links to C libraries
> >    it goes out of my area of expertise.
> Hrm,, unfortunately, it does use the SQLite library (www.sqlite.org). Is
> it possible to link the library in the binary or do something else ?

I haven't tested, and there is a gotcha that needs manual editing) but the
idea would be

- everything the same as earlier. 
- put static libraries of any library you
  need in a dir, say /usr/cross/freebsdlib (don't forget libc and libgcc)
- compile using

ppc386 -Tfreebsd -Fl/usr/cross/freebsdlib -kfail <other options> <yourfile>

The process will terminate with an linking error 

edit ppas.sh to remove the "fail" word
edit link.res and remove all searchdirs except the /usr/cross/freebsdlib one
run ./ppas.sh

Copy the generated file to freebsd, say a prayer, and run it.

> In any case, if it's not possible at all with your current knowledge,
> I'd like to know how it's done anyway for a pure FPC program :)

A better word would be that I haven't tested it yet. But I will soon.  

More information about the fpc-pascal mailing list