[fpc-pascal] How do you build FPC?

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Fri Feb 20 11:25:29 CET 2015


Jon Foster wrote:
> I'm using i386 32bit Linux for most of my development and currently
> using FPC 2.6.0. I'm trying to understand how to build FPC for various
> scenarios: Cross-compiling FPC for another architecture. Building FPC
> crosscompilers and related units so I can compile for them from my Linux
> machine. And building new FPC versions.
> 
> There seems to be a massive lack of documentation about the FPC build
> process and many things I try get me know where. I'll do something like
> "make deb" and I get "/bin/cp: cannot stat `logs': No such file or
> directory ..." Or I do "make build OS_TARGET=win32 SMARTLINK=YES
> DEFAULTUNITS=YES NOGDB=1" and it builds a i386-linux RTL with i386-win32
> packages!?!?
> 
> I've tried building on I386 Linux, PPC Linux, PPC OSX, just to name the
> ones that I remember. I've tried simple builds of newer FPCs, cross
> compiling FPC, building crosscompilers and units. Building Debian packages.
> 
> Not once have I ever been able to get it to do what I want. There is
> obviously a lot of pieces I'm missing from what I've dug up on the wiki,
> docs and included text files.
> 
> Is there documentation for compiling FPC? Am I just missing it
> somewhere? FPC seems incredibly flexible and I'd like to take advantage
> of it on some other platforms but so far it looks like that is reserved
> for a wizard elite somewhere and nobody is saying how to get there.

The document that is usually cited is 
http://www.stack.nl/~marcov/buildfaq.pdf which I think is still 
generally valid. I don't know whether this is the only URL, or if it's 
also hosted on the FreePascal site.

In all cases the correct compiler to start with is the current one (i.e. 
at the time of writing v2.6.4), the makefiles generally check and 
enforce this and it is unwise to override it.

Apart from that, and with the caveat that I am not a core developer and 
this is probably not an orthodox opinion or advice, for building 
natively on Linux (also Solaris, OS X etc.) I simply use something like

make NOGDB=1 OPT='-O- -gl -Xs-' all

That's a very conservative build, with minimal optimisation etc. so that 
if something goes wrong a backtrace can be had without having to 
rebuild. Alternatively see http://wiki.freepascal.org/fpcup

To get the idea of how bootstrapping and cross compilers hang together, 
you might find http://wiki.freepascal.org/Native_MIPS_Systems useful. I 
tweaked that a few days ago since I think a couple of steps were in the 
wrong order.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list