F.4.2 Compiling the compiler

Compiling the compiler can be done with one statement. It’s always best to remove all units from the compiler directory first, so something like

rm *.ppu *.o

on linux, and on dos

del *.ppu  
del *.o

After this, the compiler can be compiled with the following command line:

ppc386 -Tlinux  -Fu../rtl/units/i386-linux -di386 -dGDB pp.pas

So, the minimum options are:

  1. The target OS. Can be skipped when compiling for the same target as the compiler which is being used.
  2. A path to an RTL. Can be skipped if a correct fpc.cfg configuration is on the system. If the compiler should be compiled with the RTL that was compiled first, this should be ../rtl/OS (replace the OS with the appropriate operating system subdirectory of the RTL).
  3. A define with the processor for which the compiler is compiled for. Required.
  4. -dGDB. Required.
  5. -Sg is needed, some parts of the compiler use goto statements (to be specific: the scanner).

So the absolute minimal command line is

ppc386 -di386 -dGDB -Sg pp.pas

Some other command line options can be used, but the above are the minimum. A list of recognised options can be found in table (F.1).


Table F.1: Possible defines when compiling FPC

Define does what


GDB Support of the GNU Debugger (required switch).
I386 Generate a compiler for the Intel i386+ processor family.
M68K Generate a compiler for the M680x0 processor family.
X86_64 Generate a compiler for the AMD64 processor family.
POWERPC Generate a compiler for the PowerPC processor family.
POWERPC64 Generate a compiler for the 64-bit PowerPC processor family.
ARM Generate a compiler for the Intel ARM processor family.
SPARC Generate a compiler for the SPARC processor family.
EXTDEBUG Some extra debug code is executed.
MEMDEBUG Some memory usage information is displayed.
SUPPORT_MMXonly i386: enables the compiler switch MMX which
allows the compiler to generate MMX instructions.
EXTERN_MSG Don’t compile the msgfiles in the compiler, always use
external messagefiles.
NOOPT Do not include the optimizer in the compiler.
CMEM Use the C memory manager.



This list may be subject to change, the source file pp.pas always contains an up-to-date list.