[fpc-devel] fpcmkcfg and fpc.cfg questions

Joost van der Sluis joost at cnoc.nl
Mon Mar 25 10:45:22 CET 2019

Op 24-03-19 om 23:21 schreef Bart:

> Extract from fpc.cfg from 3.0.4 (created by offcial installer)
> # searchpath for units and other system dependent things
> -FuC:\devel\fpc\3.0.4/units/$fpctarget
> -FuC:\devel\fpc\3.0.4/units/$fpctarget/*
> -FuC:\devel\fpc\3.0.4/units/$fpctarget/rtl
> Extract from fpc.cfg from fpc trunk: created with fpcmkcfg.exe (from trunk)
> # searchpath for units and other system dependent things
> -Fu/units/$fpctarget
> -Fu/units/$fpctarget/*
> -Fu/units/$fpctarget/rtl

You have to give fpcmkcfg some parameters. The installer does that (or, 
on unices, samplecfg does this for you.)

fpcmkcfg is just a simple template-processor, with a few templates build 
in. For example, you can see the template for fpc.cfg when you run 
fpcmkcfg as follows: 'fpcmkcfg -0 -b'

It contains the following part:

# searchpath for units and other system dependent things

To create a working fpc.cfg, you have to provide the %basepath% on the 
command-line. (There are a few build-in macro's, you can see them using 
'fpcmkcfg -m')

So in your case the command to generate fpc.cfg would be:

fpcmkcfg -0 -d basepath=C:\devel\fpc\3.3.1

Or, what I would do, to be able to support multiple versions with the 
same fpc.cfg:

fpcmkcfg -0 -d basepath=C:\devel\fpc\$fpcversion

> Notice all paths are relative (to what?)
> How does fpc know that, in relation to fpc.exe this must be translated to:
> ..\..\units\$fpctarget  ?

No, that won't work. (At least, it is not how it is designed, might 
work, though. Never tested)

> Q1: How come? Why does it find C:\pp\units\i386-win32\fcl-db\db.ppu now?
> Q2: why did the installer from 3.0.4 use fully qualified paths and
> fpcmkcfg does not?

I think that these questions are answered now?

> Second problem:
> Is this supposed to happen?
> C:\pp\bin\i386-win32>dir fpc.cfg
> ...
> 24-03-2019  00:31             7.572 fpc.cfg
> C:\pp\bin\i386-win32>fpcmkcfg -o fpc.cfg
> Saved old "fpc.cfg" to "fpc.bak"
> Error: Directory of file "fpc.cfg" does not exists. User -p to force creation.
> C:\pp\bin\i386-win32>dir fpc.cfg
> ...
> Directory of C:\pp\bin\i386-win32
> File Not Found
> It just killed my fpc.cfg!
> (Yes there is a backup)
> This works however:
> fpcmkcfg -o .\fpc.cfg
> I would say that fpc.cfg as commandline parameter should point to the
> same file as .\fpc.cfg (as it would do in almost any other program).
> Q3: is this a bug or "by design"?

ERhm... I can not think of any design that makes this logical. I'm not 
the one who builds and maintains the windows installers, though. So it's 
a bug, I would say.



http://lazarussupport.com - Your donation helps to push Free Pascal and 
Lazarus forwards.

More information about the fpc-devel mailing list