Recent

Author Topic: fpc.cfg location  (Read 5429 times)

lagprogramming

  • Full Member
  • ***
  • Posts: 161
fpc.cfg location
« on: July 21, 2015, 02:50:11 pm »
Hi!
   Knowing a compiler path, I'd like to know if there's a default fpc configuration file available and if it is, I'd like to know if the compiler given by the path is able to use that configuration file.
   Example:
   I have one compiler at "c:\fpc\bin\fpc.exe". I'd like to know if there is a valid default "fpc.cfg" file. If there is, then I'd like to know if the "whateverpath\fpc.cfg" configuration file is compatible with "c:\fpc\bin\fpc.exe".
The incompatibility may appear because the configuration file may be used by two compilers with different versions.
   I was thinking that maybe fpc might have a parameter like those "fpc -iX", a parameter that will make fpc return the path of a default configuration file. It doesn't so I need a different approach. I've read the documentation and finding the configuration file on different OS-es is painful.

kapibara

  • Hero Member
  • *****
  • Posts: 532
Re: fpc.cfg location
« Reply #1 on: July 21, 2015, 06:42:43 pm »
In the same DIR as fpc.exe, you also find fpcmakecfg.exe. Run that tool and it will create a default fpc.cfg for you that matches the location of your fpc installation:

http://wiki.freepascal.org/Installing_Lazarus#STEP_.234:_Create_fpc.cfg_file

If you look inside fpc.cfg you will see a lot of paths. I dont think you can make a default file and use it over and over for other installations of fpc. The paths will not match. Probably thats why fpcmakecfg exists. Or you can edit the paths manually and save as new file. Thats what I did before I learnt about fpcmakecfg.

As far as I understand, the fpc.cfg must always be in the same DIR as fpc.exe, so it should not be difficult to find?
« Last Edit: July 21, 2015, 07:26:00 pm by kapibara »
Lazarus trunk / fpc 3.0.4 / Debian 10 - 64 bit

lagprogramming

  • Full Member
  • ***
  • Posts: 161
Re: fpc.cfg location
« Reply #2 on: July 21, 2015, 08:10:51 pm »
As far as I understand, the fpc.cfg must always be in the same DIR as fpc.exe, so it should not be difficult to find?

   Well, here is my dilemma.
   Take a look at http://www.freepascal.org/docs-html/user/usersu10.html. It says that fpc looks for the configuration file even within the directory specified in the environment variable PPC_CONFIG_PATH. Obviously the search order matters and you'll see that it's influenced by the OS. I understand from the manual that for *nix systems if you place the configuration file in the same directory as the compiler it will be completely ignored.
   As an example, let's take a look at Lazarus because it's the most used here. You can select the compiler at "Menu/Tools/Options.../Environment/Files/" but the configuration file may be changed at "Menu/Project/Project Options.../Compiler Options/Config and Target/". This means that if you change just the compiler path then it is possible to rebuild Lazarus using an obsolete(inadecvate) fpc configuration file, isn't it!? I've done some tests with fpgui too and the situation got worse if you're not careful. To me, it looks like if you don't know for sure the compiler&fpc.cfg combination, things might work just by pure luck.
   I still think I miss something important, reason why I've opened this forum subject.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8319
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: fpc.cfg location
« Reply #3 on: July 22, 2015, 12:58:23 am »
As an example, let's take a look at Lazarus because it's the most used here. You can select the compiler at "Menu/Tools/Options.../Environment/Files/" but the configuration file may be changed at "Menu/Project/Project Options.../Compiler Options/Config and Target/". This means that if you change just the compiler path then it is possible to rebuild Lazarus using an obsolete(inadecvate) fpc configuration file, isn't it!?
It's a misuse IMO. The IDE doesn't use project specific fpc.cfg, after all, that's why the location differs (environment vs project), because it explains scope which configuration applies where. Along with the global config file, the IDE uses idemake.cfg which is autogenerated based on installed packages and "Tools->Configure Build Lazarus" contents.

 

TinyPortal © 2005-2018