[fpc-devel] Statistics on compiling the Free Pascal compiler for Win32

Sven Barth pascaldragon at googlemail.com
Tue Jan 17 10:00:42 CET 2012

Am 17.01.2012 05:19, schrieb Paul Robinson:
> Compiling using the DOS IDE, I brought up the file PP.PAS, declared it
> as the primary file, for compiler switches, I entered into the IDE the
> following:
> Win32 I386 cpu32bitaddr
> Each time it did not find a Pascal Unit I cheated, looked for the file
> and copied it into the 'compiler' directory rather than try to set the
> directories in the IDE because I was having trouble or doing something
> wrong and it didn't find the files. So then, once it stopped
> complaining, I had it do a 'build' to do a complete scratch build of the
> compiler.

The following command is sufficient to build a compiler for the i386 
platform (from inside cmd.exe):

fpc -FUlib -otestpp.exe -FE. -Fusystems -Fui386 -Fux86 -Fii386 -di386 pp.pas

"-FUlib" specifies that all *.o and *.ppu files are generated in 
directory "lib" (which you need to create first)
"-otestpp.exe" specifies that the resulting executable should be named 
"-FE." tells the compiler that the resulting executable should be 
created in teh current directory
"-FuXXX" are the directories which contain other used units
"-FiXXX" specifies directories which contain include files
"-di368" will generate a compiler for "i386". Other possibilities can be 
seen in the comments of pp.pas

If you have already compiled the compiler using the Makefile ("make all" 
in the top level directory of the FPC source or "make cycle" in the 
directory of the compiler) then you can use the "manually" created 
compiler to compile itself again using the following command:

testpp.exe -n -Fu{YOURSOURCEDIRECTORY}\rtl\units\i386-win32 -B -FUlib 
"-otestpp2.exe" "-FE." -Fusystems -Fui386 -Fux86 -Fii386 -di386 -vinw pp.pas

"-n" tells the compiler not to use its default configuration file
The parameter containing {YOURSOURCEDIRECTORY} is the directory where 
the Makefile (see above) compiled the RTL (RunTime Library) to (we need 
that now that we don't use the default configuration).
"-B" tells the compiler to recompile all units.
We also use a different name, as "testpp.exe" can not be overriden while 
it's running.
"-vinw" tells the compiler to display general information (like 
"Compiling blabla.pas"), notes and warnings (this is normally also 
included in the default configuration).


More information about the fpc-devel mailing list