[Lazarus] How to pass path of fpc to make command, and some thoughts on Lazarus/FPC Installation.

Sven Barth pascaldragon at googlemail.com
Fri Sep 24 17:45:32 CEST 2010

Am 24.09.2010 17:25, schrieb Frank Church:
> 1. The fpc executable is installed in ~/LazarusInstalls/fpc240/bin/fpc
> When I execute ~/LazarusInstalls/fpc240/bin/fpc, the first 3 lines of
> output say:
> Free Pascal Compiler version 2.2.4-3 [2009/06/03] for i386
> Copyright (c) 1993-2008 by Florian Klaempfl
> /usr/lib/fpc/2.2.4/ppc386 [options] <inputfile> [options]
> Obviously fpc calls ppc386 that is in the path, perhaps there is no
> fpc.cfg available.

There might be a .fpc.cfg in ~/ from your 2.2.4, but the ppc386 might 
indeed be called by using $PATH. You can check that by overriding it 
temporaily by calling fpc in the following way (please adjust the paths 
if necessary, I constructed them out of memory):

PATH=~/LazarusInstalls/fpc240/lib/fpc/2.4.0 ~/LazarusInstalls/fpc240/bin/fpc

> So how I can create an fpc.cfg and pass it the fpc I just compiled?
> Couldn't the install script create a suitable fpc.cfg to match the
> installation directory?

There should be a makeskel or similar binary in fpc240/bin/fpc which you 
can call to create a config skeleton (you might call it with -h to see 
its help).

You might also copy your 2.2.4 config file and change all occurences of 
"/usr/lib/fpc/2.2.4" to "/home/???/LazarusInstalls/fpc240/lib/fpc/2.4.0".

> 2. Onto Lazarus
> cd ~/LazarusBuilds
> svn checkout http://svn.freepascal.org/svn/lazarus/trunk lazarus27446
> cd lazarus27446
> make obviously fails here because I don't know the option of passing my
> shiny new fpc 2.4.0 to the make command.
> Is there an option for that, and are there other options to ensure that
> new compiler will only link
> with files from its subdirectories?
> There is also this hilarious bit in the README.txt that says.
> ==================
> Compilation:
> You don't need ./configure, just do
>    []$ make clean all
> This will create the lazarus executable. Start it and enjoy.
> ===================
> What, doesn't even need FreePascal?
> There may be some legacy reasons why Lazarus/FPC doesn't use the
> ./configure approach, but at least a well documented bash script which
> allows you to set some variables before compilation would be very helpful.

There is no legacy reason besides FPC simply not using it cause FPC 
doesn't need it.

You can pass the used compiler binary by adding 
"FPC=~/LazarusInstalls/fpc240/lib/fpc/2.4.0/ppc386" to the "make" 
command line (after "clean all"). Please note that you also need the 
~/.fpc.cfg for this to work.

Note: You should(!) be able to use a different config file than 
"~/.fpc.cfg" by passing "OPT=@/path/to/fpc.cfg" to the make command as well.

> After all, the main idea of programming is never to use constants or
> literals where well documented
> variables will do

Yes, but setting up different versions of FPC needs a bit of a creative 
thinking process and I've yet to think of an easier way than using a 
"switch script" ^^


More information about the Lazarus mailing list