Sign in Join

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

Mailing lists / lazarus / 2012-09

Bug 0022814: fpc executable's path should be relative if fpc is present in the env path

11 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

patspiper

http://bugs.freepascal.org/view.php?id=22814

To launch the IDE, I use a script that lets me select the FPC version and then:
-----------------------------
export PATH=/home/me/Programs/fpc/$FPC_VER/lib/fpc/$FPC_VER:$PATH export PATH=/home/me/Programs/fpc/$FPC_VER/bin:$PATH export PATH=/home/me/Programs/fpc/crossbinutils/bin:$PATH cd /tmp
/home/supra/Programs/lazarus/lazarus-svn/startlazarus --pcp="/home/me/Programs/lazarus/config-lazarus-svn" ${CMD_LINE_PARAMS} -----------------------------

$FPC_VER is 2.6.1 or 2.7.1 for example.

CMD_LINE_PARAMS is for debug purposes
("--debug-enable=DBG_CMD_ECHO,DBG_STATE,DBG_DATA_MONITORS,DBGMI_QUEUE_DEBUG,DBGMI_TYPE_INFO --debug-log=/tmp/laz.log")

An FPCVER dropdown list in the IDE options could be a solution (Changing it must trigger the rescan FPC source directory in case it is affected by the version change). However, will fpc be able to locate ppc386 (the actual compiler)?

Are there fpc executables other than fpc and the actual compiler needed by the IDE?

Stephano

Reply by email

Mattias Gaertner
to patspiper

patspiper hat am 6. September 2012 um 13:58 geschrieben:

Show quoted text 6 lines
http://bugs.freepascal.org/view.php?id=22814 To launch the IDE, I use a script that lets me select the FPC version and then: ----------------------------- export PATH=/home/me/Programs/fpc/$FPC_VER/lib/fpc/$FPC_VER:$PATH

Why the above path?

Show quoted text 17 lines
export PATH=/home/me/Programs/fpc/$FPC_VER/bin:$PATH export PATH=/home/me/Programs/fpc/crossbinutils/bin:$PATH cd /tmp /home/supra/Programs/lazarus/lazarus-svn/startlazarus --pcp="/home/me/Programs/lazarus/config-lazarus-svn" ${CMD_LINE_PARAMS} ----------------------------- $FPC_VER is 2.6.1 or 2.7.1 for example. CMD_LINE_PARAMS is for debug purposes ("--debug-enable=DBG_CMD_ECHO,DBG_STATE,DBG_DATA_MONITORS,DBGMI_QUEUE_DEBUG,DBGMI_TYPE_INFO --debug-log=/tmp/laz.log") An FPCVER dropdown list in the IDE options could be a solution (Changing it must trigger the rescan FPC source directory in case it is affected by the version change). However, will fpc be able to locate ppc386 (the actual compiler)?

Changing the the compiler in the IDE triggers a rescan of the compiler, which updates the FPCVer macro. If the path to the FPC sources contains the macro FPCVer the IDE switches to it. If this directory was not yet scanned it will be scanned now. The IDE has a cache for multiple compilers and multiple FPC source directories.

You can switch the compiler by using the combobox in the project's options or by using build modes.

Are there fpc executables other than fpc and the actual compiler needed by the IDE?

Yes. What exactly depends on your program. For example fpcres is commonly used. These tools are called by the compiler, not the IDE.

Mattias

Reply by email

patspiper
to Mattias Gaertner
Mattias Gaertner wrote 8 lines
patspiper hat am 6. September 2012 um 13:58 geschrieben: > http://bugs.freepascal.org/view.php?id=22814 > > To launch the IDE, I use a script that lets me select the FPC version > and then: > ----------------------------- > export PATH=/home/me/Programs/fpc/$FPC_VER/lib/fpc/$FPC_VER:$PATH Why the above path?

Because the actual compiler and cross-compilers are there. Otherwise fpc (which is in /home/me/Programs/fpc/$FPC_VER/bin) would not be able to locate ppc386 and ppcross386. And consequently, one cannot switch FPC versions without restarting the IDE.

Show quoted text 24 lines
> export PATH=/home/me/Programs/fpc/$FPC_VER/bin:$PATH > export PATH=/home/me/Programs/fpc/crossbinutils/bin:$PATH > cd /tmp > /home/supra/Programs/lazarus/lazarus-svn/startlazarus > --pcp="/home/me/Programs/lazarus/config-lazarus-svn" ${CMD_LINE_PARAMS} > ----------------------------- > > $FPC_VER is 2.6.1 or 2.7.1 for example. > > CMD_LINE_PARAMS is for debug purposes > ("--debug-enable=DBG_CMD_ECHO,DBG_STATE,DBG_DATA_MONITORS,DBGMI_QUEUE_DEBUG,DBGMI_TYPE_INFO > --debug-log=/tmp/laz.log") > > An FPCVER dropdown list in the IDE options could be a solution (Changing > it must trigger the rescan FPC source directory in case it is affected > by the version change). However, will fpc be able to locate ppc386 (the > actual compiler)? Changing the the compiler in the IDE triggers a rescan of the compiler, which updates the FPCVer macro. If the path to the FPC sources contains the macro FPCVer the IDE switches to it. If this directory was not yet scanned it will be scanned now. The IDE has a cache for multiple compilers and multiple FPC source directories.

Great! But the only shortcoming is that:
- if the actual compiler is not in the path, fpc cannot call it no matter what.
- if the actual compiler is in the path, then an odd situation will arise where the IDE will report a mix of FPC versions in about FPC (IDE internals), the old actual compiler will still be used, and the new sources are used.

You can switch the compiler by using the combobox in the project's options or by using build modes.

The target in project options just cause fpc to call the required actual compiler. The pitfall is the same as above.

Show quoted text 6 lines
> Are there fpc executables other than fpc and the actual compiler needed > by the IDE? Yes. What exactly depends on your program. For example fpcres is commonly used. These tools are called by the compiler, not the IDE.

This is why the 1st path is required (they are located in the same folder as the fpc binary).

Stephano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120906/f000c5ed/attachment.html>

Reply by email

Sven Barth
to patspiper
patspiper wrote 12 lines
>> An FPCVER dropdown list in the IDE options could be a solution (Changing >> it must trigger the rescan FPC source directory in case it is affected >> by the version change). However, will fpc be able to locate ppc386 (the >> actual compiler)? > Changing the the compiler in the IDE triggers a rescan of the compiler, which > updates the FPCVer macro. If the path to the FPC sources contains the macro > FPCVer the IDE switches to it. If this directory was not yet scanned it will be > scanned now. The IDE has a cache for multiple compilers and multiple FPC source > directories. Great! But the only shortcoming is that: - if the actual compiler is not in the path, fpc cannot call it no matter what.

You can pass the option "-Xp/some/path" to fpc to tell it to look for ppcXXX in that specific directory. It will look there first, then in the path of the fpc binary and then in PATH.

And using the option "-Vsomething" you can specify a suffix the compiler will use to locate the ppcXXX. E.g. "-V2-7-1" will tell fpc to look for ppc386-2-7-1 on a x86 system.

Regards,
Sven

Reply by email

Mattias Gaertner
to Sven Barth
Show quoted text 8 lines
[...] You can pass the option "-Xp/some/path" to fpc to tell it to look for ppcXXX in that specific directory. It will look there first, then in the path of the fpc binary and then in PATH. And using the option "-Vsomething" you can specify a suffix the compiler will use to locate the ppcXXX. E.g. "-V2-7-1" will tell fpc to look for ppc386-2-7-1 on a x86 system.

Is there already a page on how to install and use multiple fpc?

Mattias

Reply by email

Sven Barth
to Mattias Gaertner
Mattias Gaertner wrote 13 lines
On Thu, 06 Sep 2012 20:07:10 +0200 Sven Barth wrote: > [...] > You can pass the option "-Xp/some/path" to fpc to tell it to look for > ppcXXX in that specific directory. It will look there first, then in the > path of the fpc binary and then in PATH. > > And using the option "-Vsomething" you can specify a suffix the compiler > will use to locate the ppcXXX. E.g. "-V2-7-1" will tell fpc to look for > ppc386-2-7-1 on a x86 system. Is there already a page on how to install and use multiple fpc?

I don't know. But if I remember correctly there isn't.

Regards,
Sven

Reply by email

patspiper
to Sven Barth: You can pass the option "-Xp/some/path" to fpc to tell it to look for ppcXXX in that…
Sven Barth wrote 23 lines
On 06.09.2012 18:11, patspiper wrote: >>> An FPCVER dropdown list in the IDE options could be a solution >>> (Changing >>> it must trigger the rescan FPC source directory in case it is affected >>> by the version change). However, will fpc be able to locate ppc386 >>> (the >>> actual compiler)? >> Changing the the compiler in the IDE triggers a rescan of the >> compiler, which >> updates the FPCVer macro. If the path to the FPC sources contains >> the macro >> FPCVer the IDE switches to it. If this directory was not yet scanned >> it will be >> scanned now. The IDE has a cache for multiple compilers and multiple >> FPC source >> directories. > Great! But the only shortcoming is that: > - if the actual compiler is not in the path, fpc cannot call it no > matter what. You can pass the option "-Xp/some/path" to fpc to tell it to look for ppcXXX in that specific directory. It will look there first, then in the path of the fpc binary and then in PATH.

This is interesting! If we can specify in the IDE options the relative path to move from the fpc binary folder (ex:
/home/me/Programs/fpc/$FPC_VER/lib/fpc/$FPC_VER) to the actual compiler folder (ex: /home/me/Programs/fpc/$FPC_VER/bin), then the IDE can call <fpc bin folder>fpc -Xp<relative path>.

Since all fpc installations have the same relative path, then it becomes enough to specify that relative path once in the IDE options so that changing the fpc binary path is enough for all purposes. By default, that path is ../lib/fpc/$(FPCVER).

Stephano

Reply by email

Mattias Gaertner
to patspiper
Show quoted text 15 lines
On 06/09/12 21:07, Sven Barth wrote: [...] > You can pass the option "-Xp/some/path" to fpc to tell it to look for > ppcXXX in that specific directory. It will look there first, then in > the path of the fpc binary and then in PATH. This is interesting! If we can specify in the IDE options the relative path to move from the fpc binary folder (ex: /home/me/Programs/fpc/$FPC_VER/lib/fpc/$FPC_VER) to the actual compiler folder (ex: /home/me/Programs/fpc/$FPC_VER/bin), then the IDE can call <fpc bin folder>fpc -Xp<relative path>. Since all fpc installations have the same relative path, then it becomes enough to specify that relative path once in the IDE options so that changing the fpc binary path is enough for all purposes. By default, that path is ../lib/fpc/$(FPCVER).

Maybe you can add this to your fpc.cfg? A normal fpc.cfg already contains a -XP.

Mattias

Reply by email

Sven Barth
to Mattias Gaertner
Mattias Gaertner wrote 21 lines
On Thu, 06 Sep 2012 21:34:42 +0300 patspiper wrote: > On 06/09/12 21:07, Sven Barth wrote: > [...] >> You can pass the option "-Xp/some/path" to fpc to tell it to look for >> ppcXXX in that specific directory. It will look there first, then in >> the path of the fpc binary and then in PATH. > This is interesting! If we can specify in the IDE options the relative > path to move from the fpc binary folder (ex: > /home/me/Programs/fpc/$FPC_VER/lib/fpc/$FPC_VER) to the actual compiler > folder (ex: /home/me/Programs/fpc/$FPC_VER/bin), then the IDE can call > <fpc bin folder>fpc -Xp<relative path>. > > Since all fpc installations have the same relative path, then it becomes > enough to specify that relative path once in the IDE options so that > changing the fpc binary path is enough for all purposes. By default, > that path is ../lib/fpc/$(FPCVER). Maybe you can add this to your fpc.cfg? A normal fpc.cfg already contains a -XP.

Please mind the casing. -XP is the binutils prefix while -Xp is the compiler search path.

Regards,
Sven

Reply by email

Sven Barth
to Sven Barth
Sven Barth wrote 25 lines
On 06.09.2012 20:38, Mattias Gaertner wrote: > On Thu, 06 Sep 2012 21:34:42 +0300 > patspiper wrote: > >> On 06/09/12 21:07, Sven Barth wrote: >> [...] >>> You can pass the option "-Xp/some/path" to fpc to tell it to look for >>> ppcXXX in that specific directory. It will look there first, then in >>> the path of the fpc binary and then in PATH. >> This is interesting! If we can specify in the IDE options the relative >> path to move from the fpc binary folder (ex: >> /home/me/Programs/fpc/$FPC_VER/lib/fpc/$FPC_VER) to the actual compiler >> folder (ex: /home/me/Programs/fpc/$FPC_VER/bin), then the IDE can call >> <fpc bin folder>fpc -Xp<relative path>. >> >> Since all fpc installations have the same relative path, then it becomes >> enough to specify that relative path once in the IDE options so that >> changing the fpc binary path is enough for all purposes. By default, >> that path is ../lib/fpc/$(FPCVER). > > Maybe you can add this to your fpc.cfg? A normal fpc.cfg already > contains a -XP. Please mind the casing. -XP is the binutils prefix while -Xp is the compiler search path.

Also fpc does NOT read the config file.

Regards,
Sven

Reply by email

patspiper
to Mattias Gaertner: On Thu, 06 Sep 2012 21:34:42 +0300 Maybe you can add this to your fpc.cfg? A normal…
Mattias Gaertner wrote 20 lines
On Thu, 06 Sep 2012 21:34:42 +0300 patspiper wrote: > On 06/09/12 21:07, Sven Barth wrote: > [...] >> You can pass the option "-Xp/some/path" to fpc to tell it to look for >> ppcXXX in that specific directory. It will look there first, then in >> the path of the fpc binary and then in PATH. > This is interesting! If we can specify in the IDE options the relative > path to move from the fpc binary folder (ex: > /home/me/Programs/fpc/$FPC_VER/lib/fpc/$FPC_VER) to the actual compiler > folder (ex: /home/me/Programs/fpc/$FPC_VER/bin), then the IDE can call > <fpc bin folder>fpc -Xp<relative path>. > > Since all fpc installations have the same relative path, then it becomes > enough to specify that relative path once in the IDE options so that > changing the fpc binary path is enough for all purposes. By default, > that path is ../lib/fpc/$(FPCVER). Maybe you can add this to your fpc.cfg? A normal fpc.cfg already contains a -XP.

As per Sven's message, this cannot be done. The fpc binary must be able to locate the actual compiler either using the env path, or the -Xp switch. Two options are available:
- Specify the relative path between the 2 folders.
- Specify the actual compiler path (the IDE can even store the relative path instead)

Both options can make use of the FPCVER macro.
Ex:
fpc binary: /home/me/Programs/fpc/2.6.1/lib/fpc/2.6.1 actual compiler: /home/me/Programs/fpc/$FPC_VER/bin

Stephano

Reply by email