Recent

Author Topic: Problem with location of fpc.cfg  (Read 6407 times)

Zoran

  • Hero Member
  • *****
  • Posts: 1830
    • http://wiki.lazarus.freepascal.org/User:Zoran
Problem with location of fpc.cfg
« on: November 03, 2015, 03:11:25 pm »
I have a functional installation of fpc 2.6.4 on Linux Mint. FPC is installed in a path under my user folder.
Now I want to install fpc 3.0.0rc2, but to leave 2.6.4. Before installation of fpc 3.0, I want to move my fpc.cfg which was created by 2.6.4 installation from user folder to some other folder.

I looked in docementation (see here), and it says:
Quote
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.

Let's say that my fpc 2.6.4 binary folder is is  ~/my_fpc_installation_dir/bin. Now I have .fpc.cfg in my user folder ~/.
So, I tried to move .fpc.cfg from ~/ to ~/my_fpc_installation_dir/etc.
The environment variable PPC_CONFIG_PATH is not set, so I expected fpc to find it there. But it cannot find it. Where am I wrong?

Please help. I would like to move it, so I could install fpc 3.0 rc2 in some other path under my user directory and put another fpc.cfg there in etc.
« Last Edit: November 03, 2015, 03:14:39 pm by Zoran »

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1059
Re: Problem with location of fpc.cfg
« Reply #1 on: November 03, 2015, 03:16:19 pm »
It looks for "fpc.cfg" in the etc directories, rather than for ".fpc.cfg" (which is the name of the file searched in your home directory).

Zoran

  • Hero Member
  • *****
  • Posts: 1830
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Problem with location of fpc.cfg
« Reply #2 on: November 03, 2015, 03:32:05 pm »
Thank you, Jonas, but I renamed .fpc.cfg to fpc.cfg (without the leading dot), but the compiler still does not see it.
Here is what I get when I try to start lazarus:


Zoran

  • Hero Member
  • *****
  • Posts: 1830
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Problem with location of fpc.cfg
« Reply #3 on: November 03, 2015, 03:35:23 pm »
To be precise, fpc bin path is /home/z/programi/fpc-2.6.4/bin/fpc and i put fpc.cfg in /home/z/programi/fpc-2.6.4/etc/fpc.cfg

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1059
Re: Problem with location of fpc.cfg
« Reply #4 on: November 03, 2015, 03:40:31 pm »
What happens if you start it from the command line? Maybe it's just a buggy check in Lazarus that you can ignore.

You can also use fpc's -va command line option to see where it looks for its configuration file.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: Problem with location of fpc.cfg
« Reply #5 on: November 03, 2015, 04:47:18 pm »
And the ppc<x> file? The ppc<x> file reads the .cfg.

Try "which ppc386"  or "which ppcx64"

Zoran

  • Hero Member
  • *****
  • Posts: 1830
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Problem with location of fpc.cfg
« Reply #6 on: November 04, 2015, 08:27:11 am »
Thanks Jonas and Marco for your help.

You can also use fpc's -va command line option to see where it looks for its configuration file.

Yes, this "va" option solved the problem.
From the output of fpc -va :
Quote
[0.000] Configfile search: /home/z/.fpc.cfg
[0.000] Configfile search: /home/z/programi/fpc-2.6.4/lib/fpc/etc/fpc.cfg
[0.000] Configfile search: /etc/fpc.cfg

Moving fpc.cfg to /home/z/programi/fpc-2.6.4/lib/fpc/etc/fpc.cfg solves the problem.

Now, why this path ../lib/fpc/etc/fpc.cfg relative from fpc (and ppcx64) and not ../etc/fpc.cfg as fpc user manual states? Should I file a bug report about wrong documentation?

« Last Edit: November 04, 2015, 08:32:52 am by Zoran »

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1059
Re: Problem with location of fpc.cfg
« Reply #7 on: November 04, 2015, 09:22:22 am »
"fpc" is not the compiler, but the compiler driver. The actual compiler is named ppc386, ppcx64 etc. There are symbolic links with those names in the "bin" directory that contains the "fpc" binary, which point to the compiler binary of the last installed version (in ../lib/fpc/$fpcversion/).

In that sense, "it will look in the etc directory above the compiler directory" is correct. It's mainly the example given in the documentation (/usr/local/bin) that's not very good, because we never install a compiler binary in that directory (well, maybe we used to do this for the very first FPC releases). So yes, it may be useful to file a bug report about that.

Zoran

  • Hero Member
  • *****
  • Posts: 1830
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Problem with location of fpc.cfg
« Reply #8 on: November 04, 2015, 10:26:26 am »
"fpc" is not the compiler, but the compiler driver. The actual compiler is named ppc386, ppcx64 etc. There are symbolic links with those names in the "bin" directory that contains the "fpc" binary, which point to the compiler binary of the last installed version (in ../lib/fpc/$fpcversion/).

In that sense, "it will look in the etc directory above the compiler directory" is correct. It's mainly the example given in the documentation (/usr/local/bin) that's not very good, because we never install a compiler binary in that directory (well, maybe we used to do this for the very first FPC releases). So yes, it may be useful to file a bug report about that.

Thank you, Jonas, for clearing this. I filed the bug report: http://bugs.freepascal.org/view.php?id=28957

 

TinyPortal © 2005-2018