Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-10

fpc.cfg on windows

8 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bernd Kreuss

Hi,

I cannot find any documentation on this: On Linux I can have my global fpc.config in /etc/fpc.cfg and it will also look for a config in ~/.fpc/fpc.cfg which is very convenient since I can put some unit search paths there that I don't want to specify in the Lazarus project file itself because the paths are on network drives and mounted in different locations on the different machines that I use to compile the same projects.

On Windows it seems the global configuration is in the bin folder since windows does not have an equivalent of /etc but where is the per-user configuration? I have tried %appdata%/fpc/fpc.cfg and %appdata%/fpc.cfg and %appdata%/.fpc/fpc.cfg and a few more combinations with and without dots but none of them seems to work. Where does fpc look for this file?

confused,
Bernd

Marco van de Voort
to Bernd Kreuss

In our previous episode, Bernd Kreuss said:

Show quoted text 13 lines
I cannot find any documentation on this: On Linux I can have my global fpc.config in /etc/fpc.cfg and it will also look for a config in ~/.fpc/fpc.cfg which is very convenient since I can put some unit search paths there that I don't want to specify in the Lazarus project file itself because the paths are on network drives and mounted in different locations on the different machines that I use to compile the same projects. On Windows it seems the global configuration is in the bin folder since windows does not have an equivalent of /etc but where is the per-user configuration? I have tried %appdata%/fpc/fpc.cfg and %appdata%/fpc.cfg and %appdata%/.fpc/fpc.cfg and a few more combinations with and without dots but none of them seems to work. Where does fpc look for this file?

On Windows it looks in the dir of the compiler, as per documentation:

http://www.freepascal.org/docs-html/user/usersu10.html#x24-310003.1.5

Bernd Kreuss
to Marco van de Voort
Marco van de Voort wrote
On Windows it looks in the dir of the compiler, as per documentation: http://www.freepascal.org/docs-html/user/usersu10.html#x24-310003.1.5

Would a feature request for making it search in the home directory make sense? IMHO this would be very useful. If I install or use a different compiler in windows I don't have any common place to put my unit search paths that just works out of the box without modifying the default compiler path.

Basically I just need a per-machine unit search path that I set once and for all without putting it into all my project files or in the config of every installed compiler. Unfortunately I also haven't found any global compiler options for all projects in Lazarus that I could use for this.

Bernd

Marco van de Voort
to Bernd Kreuss

In our previous episode, Bernd Kreuss said:

Show quoted text 6 lines
> On Windows it looks in the dir of the compiler, as per documentation: > > http://www.freepascal.org/docs-html/user/usersu10.html#x24-310003.1.5 Would a feature request for making it search in the home directory make sense?

It probably has its origin in the fact that not all win9x systems have a homedir. I'm not sure this is a requirement for the compiler though (as opposed to compiled files). Even win2000 is out of extended support nowadays.

IMHO this would be very useful. If I install or use a different compiler in windows I don't have any common place to put my unit search paths that just works out of the box without modifying the default compiler path.

Well, you could use the environment variable, as described in the manual. When set in the system environment, that way it would be even independant of loggedin user.

Sven Barth
to Bernd Kreuss: Would a feature request for making it search in the home directory make sense? IMHO this…
Bernd Kreuss wrote
Basically I just need a per-machine unit search path that I set once and for all without putting it into all my project files or in the config of every installed compiler. Unfortunately I also haven't found any global compiler options for all projects in Lazarus that I could use for this.

In trunk version of Lazarus you can set a configuration as "default for new projects". There aren't any global options (you can create a feature request if you really need them, or check whether someone already created one).

Regards,
Sven

Bernd Kreuss
to Sven Barth
Sven Barth wrote
In trunk version of Lazarus you can set a configuration as "default for new projects".

[OT] If the same option that can put an @extracfg.cfg on a per project basis would also be implemented in Lazarus' environment options to put another @globalextracfg.cfg behind it for *all* projects, this would be nice and provide enough flexibility.

[On-Topic again] Can multiple @someconfig.cfg options be chained on the command line and it will then include them all in this order (I admit I am too lazy to try this now but I suspect this is possible)?

Bernd

Sven Barth
to Bernd Kreuss: [OT] If the same option that can put an @extracfg.cfg on a per project basis would also…
Bernd Kreuss wrote 10 lines
On 10.10.2010 13:54, Sven Barth wrote: > In trunk version of Lazarus you can set a configuration as "default for > new projects". [OT] If the same option that can put an @extracfg.cfg on a per project basis would also be implemented in Lazarus' environment options to put another @globalextracfg.cfg behind it for *all* projects, this would be nice and provide enough flexibility.

Then what about creating a feature request? :)

[On-Topic again] Can multiple @someconfig.cfg options be chained on the command line and it will then include them all in this order (I admit I am too lazy to try this now but I suspect this is possible)?

I just tested it. You can do that, but the order might be important (depends on the options you use). I did the following test on a i386-linux system:

==== fpc1.cfg ====
-Twin32
====

==== fpc2.cfg ====
-Fu/mnt/data/applications/fpc/2.5.1/lib/fpc/2.5.1/units/$fpctarget/rtl ====

==== call 1 ====
fpc -n @fpc1.cfg @fpc2.cfg test.pas
====

==== call 2 ====
fpc -n @fpc2.cfg @fpc1.cfg test.pas
====

In call 1 FPC compiles test.pas successfully as a Win32 application. In call 2 FPC raises an error, because fpc2.cfg is read first and while reading the $fpctarget is replaced with "i386-linux" (the current target) and then fpc1.cfg is set where the target is set to Win32. Thus compiler searches in the i386-linux unit directory for i386-win32 ppus (and thus complains that system.pp was compiled for the wrong target).

Regards,
Sven