Sign in Join

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

Mailing lists / lazarus / 2010-10

Lazarus IDE and fpc.cfg location

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

patspiper

The FPC user manual states the compiler will look for a configuration file fpc.cfg in the following places:
? Under UNIX (such as LINUX)
1. The current directory.
2. Your home directory, it looks for .fpc.cfg.
3. The directory specified in the environment variable PPC_CONFIG_PATH, and if it is
not set, it will look in the etc directory above the compiler directory. (For instance, if the
compiler is in /usr/local/bin, it will look in /usr/local/etc)
4. The directory /etc.
? Under all other OSes:
1. The current directory.
2. If it is set, the directory specified in the environment variable PPC_CONFIG_PATH.
3. The directory where the compiler is.

whereas the IDE looks in the following places:
1. $HOME/.fpc.cfg
2. compiler path + fpc.cfg
3. working directory + fpc.cfg
4. /etc/fpc.cfg (on Unix only)

1. Shouldn't the IDE follow what the FPC user manual states? In particular, compilerpath/../etc vs compilerpath
2. I tried to put fpc.cfg in the fpc binary directory, but the IDE did not detect it. Is that a bug?

Reply by email

Vincent Snijders
to patspiper

2010/10/22 patspiper :

Show quoted text 25 lines
The FPC user manual states the compiler will look for a configuration file fpc.cfg in the following places: ? Under UNIX (such as LINUX) 1. The current directory. 2. Your home directory, it looks for .fpc.cfg. 3. The directory specified in the environment variable PPC_CONFIG_PATH, and if it is not set, it will look in the etc directory above the compiler directory. (For instance, if the compiler is in /usr/local/bin, it will look in /usr/local/etc) 4. The directory /etc. ? Under all other OSes: 1. The current directory. 2. If it is set, the directory specified in the environment variable PPC_CONFIG_PATH. 3. The directory where the compiler is. whereas the IDE looks in the following places: 1. $HOME/.fpc.cfg 2. compiler path + fpc.cfg 3. working directory + fpc.cfg 4. /etc/fpc.cfg (on Unix only) 1. Shouldn't the IDE follow what the FPC user manual states? In particular, compilerpath/../etc vs compilerpath

The IDE doesn't use the .fpc.cff, the called compiler does. So, it does follow the FPC user manual as much as it can.

2. I tried to put fpc.cfg in the fpc binary directory, but the IDE did not detect it. Is that a bug?

Maybe, but then not in Lazarus, but in the compiler. Do you actually use the fpc binary in the directory of fpc.cfg? Is that compiler set in the environment options? Does it work if you use that compiler from the command line yourself?

Vincent

Reply by email

patspiper
to Vincent Snijders
Vincent Snijders wrote 42 lines
2010/10/22 patspiper: > The FPC user manual states the compiler will look for a configuration file > fpc.cfg in the following places: > ? Under UNIX (such as LINUX) > 1. The current directory. > 2. Your home directory, it looks for .fpc.cfg. > 3. The directory specified in the environment variable PPC_CONFIG_PATH, and > if it is > not set, it will look in the etc directory above the compiler directory. > (For instance, if the > compiler is in /usr/local/bin, it will look in /usr/local/etc) > 4. The directory /etc. > ? Under all other OSes: > 1. The current directory. > 2. If it is set, the directory specified in the environment variable > PPC_CONFIG_PATH. > 3. The directory where the compiler is. > > whereas the IDE looks in the following places: > 1. $HOME/.fpc.cfg > 2. compiler path + fpc.cfg > 3. working directory + fpc.cfg > 4. /etc/fpc.cfg (on Unix only) > > 1. Shouldn't the IDE follow what the FPC user manual states? In particular, > compilerpath/../etc vs compilerpath > The IDE doesn't use the .fpc.cff, the called compiler does. So, it does follow the FPC user manual as much as it can. > 2. I tried to put fpc.cfg in the fpc binary directory, but the IDE did not > detect it. Is that a bug? > Maybe, but then not in Lazarus, but in the compiler. Do you actually use the fpc binary in the directory of fpc.cfg? Is that compiler set in the environment options? Does it work if you use that compiler from the command line yourself? Vincent

I was experimenting on how to install FPC 2.5.1 alongside of 2.4.0, the config file of which is /etc/fpc.cfg. Putting fpc.cfg in the fpc binary directory did not work whereas it worked when placed in the home folder (.fpc.cfg).
I deduced the sequence above from the following excerpt from CheckCompilerOpts.pas (part of the IDE):
--------------------------------------------

   // check $HOME/.fpc.cfg
   Dir:=GetEnvironmentVariableUTF8('HOME');
   if Dir'' then begin
     Filename:=CleanAndExpandDirectory(Dir)+'.fpc.cfg';
     AddFile(Filename);
   end;
   // check compiler path + fpc.cfg
   Dir:=ExtractFilePath(CompilerFilename);
   Dir:=ReadAllLinks(Dir,false);
   if Dir'' then begin
     Filename:=CleanAndExpandDirectory(Dir)+'fpc.cfg';
     AddFile(Filename);
   end;
   // check working directory + fpc.cfg
   Dir:=ExtractFilePath(Options.BaseDirectory);
   Dir:=ReadAllLinks(Dir,false);
   if Dir'' then begin
     Filename:=CleanAndExpandDirectory(Dir)+'fpc.cfg';
     AddFile(Filename);
   end;
   // check /etc/fpc.cfg
   {$IFDEF Unix}
     Dir:=ExtractFilePath(CompilerFilename);
     Dir:=GetEnvironmentVariableUTF8('HOME');
     if Dir'' then begin
       Filename:='/etc/fpc.cfg';
       AddFile(Filename);
     end;
   {$ENDIF}
--------------------------------------------

Reply by email

shoKwave
to patspiper
patspiper wrote 14 lines
>> 3. The directory specified in the environment variable >> PPC_CONFIG_PATH, and >> if it is >> not set, it will look in the etc directory above the compiler >> directory. >> (For instance, if the >> compiler is in /usr/local/bin, it will look in /usr/local/etc) >> I was experimenting on how to install FPC 2.5.1 alongside of 2.4.0, the config file of which is /etc/fpc.cfg. Putting fpc.cfg in the fpc binary directory did not work whereas it worked when placed in the home folder (.fpc.cfg).

Note, the compiler isn't fpc but ppc386/ppcx64. so you have to put the fpc.cfg to "<basedir>/lib/fpc/etc". I have so on my ubuntu.

regards
Ingo

Reply by email

patspiper
to shoKwave
shoKwave wrote
Note, the compiler isn't fpc but ppc386/ppcx64. so you have to put the fpc.cfg to "<basedir>/lib/fpc/etc". I have so on my ubuntu.

I tested and can confirm that indeed.

However, what do CompilerFilename and Options.BaseDirectory refer to in
the following snippet from CheckCompilerOpts.pas?
-----------------------------------
   // check compiler path + fpc.cfg
   Dir:=ExtractFilePath(CompilerFilename);
   Dir:=ReadAllLinks(Dir,false);
   if Dir'' then begin
     Filename:=CleanAndExpandDirectory(Dir)+'fpc.cfg';
     AddFile(Filename);
   end;
   // check working directory + fpc.cfg
   Dir:=ExtractFilePath(Options.BaseDirectory);
   Dir:=ReadAllLinks(Dir,false);
   if Dir'' then begin
     Filename:=CleanAndExpandDirectory(Dir)+'fpc.cfg';
     AddFile(Filename);
   end;
-----------------------------------

Reply by email