Sign in Join

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

Mailing lists / fpc-devel / 2014-10

fpcmkcfg invocation for two versions (linux)

8 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

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

Gennadiy Poryev

Hello,

I've got two FPC versions installed on my Linux x64 box: 2.6.4 as a bootstrap and 2.7.1 for building Lazarus. Both were installed through 'make zipinstall' from svn and untaring to /usr, hence they reside under /usr/lib64/fpc/2.6.4/ and /usr/lib64/fpc/2.7.1/ accordingly. The switching is done by force-resymlinking /usr/bin/ppcx64 to the correct ppcx64 in their corresponding locations so that /usr/bin/fpc may invoke needed binary. Now Lazarus does not build, complaining about RegisterFCL and I know this is because of missing fpc.cfg.
What is the proper way of generating fpc.cfg in such case? I'm particularly concerned about how do define 'basepath'. I did that on Windows easily since bin directory was also located under version directory, which is not the case in Linux.

Thanks in advance,
G.

Reply by email

Marco van de Voort
to Gennadiy Poryev

In our previous episode, Gennadiy Poryev said:

Show quoted text 12 lines
I've got two FPC versions installed on my Linux x64 box: 2.6.4 as a bootstrap and 2.7.1 for building Lazarus. Both were installed through 'make zipinstall' from svn and untaring to /usr, hence they reside under /usr/lib64/fpc/2.6.4/ and /usr/lib64/fpc/2.7.1/ accordingly. The switching is done by force-resymlinking /usr/bin/ppcx64 to the correct ppcx64 in their corresponding locations so that /usr/bin/fpc may invoke needed binary. Now Lazarus does not build, complaining about RegisterFCL and I know this is because of missing fpc.cfg. What is the proper way of generating fpc.cfg in such case? I'm particularly concerned about how do define 'basepath'. I did that on Windows easily since bin directory was also located under version directory, which is not the case in Linux.

A solution for the ppc* binary is to make a symlink for one of the binaries (typically trunk) to ppx64-2.7.1, and to call "fpc" with -P2.7.1

This still assumes 2.6.x and 2.7.x can use the same "fpc" binaries, and is no solution for the rest.

I don't know fpcmkcfg that well, but the idea is that all paths in fpc.cfg for this are done using $FPCVERSION for the versionnumber.

I made the setup for cmdline use (not lazarus), and I use a small shellscript "fpcx" that adds the -P parameter, (fpc -P2.7.1 $*) and call fpcx if I want to compile with trunk.

Generally I have projects that *must* use trunk, and the rest uses stable, so I've no need to clean my application dirs before switching, since I never do.

Reply by email

Mark Morgan Lloyd
to Marco van de Voort
Marco van de Voort wrote 19 lines
In our previous episode, Gennadiy Poryev said: > I've got two FPC versions installed on my Linux x64 box: 2.6.4 as a > bootstrap and 2.7.1 for building Lazarus. Both were installed through > 'make zipinstall' from svn and untaring to /usr, hence they reside under > /usr/lib64/fpc/2.6.4/ and /usr/lib64/fpc/2.7.1/ accordingly. The > switching is done by force-resymlinking /usr/bin/ppcx64 to the correct > ppcx64 in their corresponding locations so that /usr/bin/fpc may invoke > needed binary. Now Lazarus does not build, complaining about RegisterFCL > and I know this is because of missing fpc.cfg. > What is the proper way of generating fpc.cfg in such case? I'm > particularly concerned about how do define 'basepath'. I did that on > Windows easily since bin directory was also located under version > directory, which is not the case in Linux. A solution for the ppc* binary is to make a symlink for one of the binaries (typically trunk) to ppx64-2.7.1, and to call "fpc" with -P2.7.1 This still assumes 2.6.x and 2.7.x can use the same "fpc" binaries, and is no solution for the rest.

I'm not up to date on trunk, but so far using the most-recent fpc seems compatible with all of 2.2.4 through 2.6.x on multiple native platforms.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Marco van de Voort
to Mark Morgan Lloyd

In our previous episode, Mark Morgan Lloyd said:

Show quoted text 5 lines
> This still assumes 2.6.x and 2.7.x can use the same "fpc" binaries, and is > no solution for the rest. I'm not up to date on trunk, but so far using the most-recent fpc seems compatible with all of 2.2.4 through 2.6.x on multiple native platforms.

I routinely mix "fpc" binary versions up too. I only mentioned it for completeness' sake.

Reply by email

Gennadiy Poryev
to Marco van de Voort: In our previous episode, Gennadiy Poryev said: A solution for the ppc* binary is to make…

thank you,

but my question was more about where to put fpc.cfg so that both versions can use it properly, or, if that is not possible, where to stuff different fpc.cfg's for the same purpose?
and what would be the basepath in either case?

Marco van de Voort wrote 37 lines
In our previous episode, Gennadiy Poryev said: > I've got two FPC versions installed on my Linux x64 box: 2.6.4 as a > bootstrap and 2.7.1 for building Lazarus. Both were installed through > 'make zipinstall' from svn and untaring to /usr, hence they reside under > /usr/lib64/fpc/2.6.4/ and /usr/lib64/fpc/2.7.1/ accordingly. The > switching is done by force-resymlinking /usr/bin/ppcx64 to the correct > ppcx64 in their corresponding locations so that /usr/bin/fpc may invoke > needed binary. Now Lazarus does not build, complaining about RegisterFCL > and I know this is because of missing fpc.cfg. > What is the proper way of generating fpc.cfg in such case? I'm > particularly concerned about how do define 'basepath'. I did that on > Windows easily since bin directory was also located under version > directory, which is not the case in Linux. A solution for the ppc* binary is to make a symlink for one of the binaries (typically trunk) to ppx64-2.7.1, and to call "fpc" with -P2.7.1 This still assumes 2.6.x and 2.7.x can use the same "fpc" binaries, and is no solution for the rest. I don't know fpcmkcfg that well, but the idea is that all paths in fpc.cfg for this are done using $FPCVERSION for the versionnumber. I made the setup for cmdline use (not lazarus), and I use a small shellscript "fpcx" that adds the -P parameter, (fpc -P2.7.1 $*) and call fpcx if I want to compile with trunk. Generally I have projects that *must* use trunk, and the rest uses stable, so I've no need to clean my application dirs before switching, since I never do. _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Joost van der Sluis
Show quoted text 6 lines
thank you, but my question was more about where to put fpc.cfg so that both versions can use it properly, or, if that is not possible, where to stuff different fpc.cfg's for the same purpose? and what would be the basepath in either case?

Normally, if you install both versions at the same location, you don't need two fpc.cfg files. Inside the fpc.cfg you can use macro's so that the the compiler searches for the right units (ppu's). This is done by fpcmkcfg by default. (Or samplecfg which is a wrapper around fpcmkcfg)

Overall the proces is quite simple: install fpc version A. Rename the compiler-executable from ie. ppcx64 to ppcx64_2_6_4. Then install fpc version b. Now you can select which version you want to use by calling the compiler using different names. (ppcx64 and ppcx64_2_6_4). This works perfectly if you use an IDE like Lazarus, in which you can simply select which compiler-executable to use. If you want to use 'fpc' to call the compiler, you need some additional tricks.

But to answer your question: you can place a fpc.cfg in the same location as the executable. If you place the executables of both compiler-versions in a different directory, they can both have their own fpc.cfg. (You can use the -va compiler option to see which fpc.cfg is actually used)

My current setup is that I have fpc-trunk installed in my home-directory. (I use 'make install PREFIX=~/fpc') And I have added ~/fpc/bin/x86_64 to my path. And I have a fpc.cfg in ~/fpc/bin/x86_64.

But I also have fpc 2.6.4 installed, the version provided by my Linux-distribution. If I need the original/latest release I use the full path to the compiler, or rename ~/fpc to ~/fpc_.

In short: there are a lot of configurations possible, and everyone can decide what's the best setup for his/her needs.

Joost.

Reply by email

Marc Weustink
to Gennadiy Poryev: but my question was more about where to put fpc.cfg so that both versions can use it…
Gennadiy Poryev wrote 6 lines
thank you, but my question was more about where to put fpc.cfg so that both versions can use it properly, or, if that is not possible, where to stuff different fpc.cfg's for the same purpose? and what would be the basepath in either case?

execute ppx64 -vut

the last lines of the output list the patch searched for fpc.cfg In my case
[0.004] Configfile search: /home/marc/.fpc.cfg
[0.004] Configfile search: /home/marc/etc/fpc.cfg
[0.004] Configfile search: /etc/fpc.cfg

I also vaguely recall that the dir of the compiler is searched too, but isn't listed here (it might be a windows only thing or something from the past)

Marc

Reply by email

Gennadiy Poryev
to Marc Weustink

Big thanks.

In case anyone stumbles over the same issue, here's the minimal working solution:
fpc -vut gives:

Configfile search: /root/.fpc.cfg
Configfile search: /usr/lib64/fpc/etc/fpc.cfg
Configfile search: /etc/fpc.cfg
Fatal: No source file name in command line
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode

Seems logical to use /usr/lib64/fpc/etc/fpc.cfg

A little investigation into what lazarus build complains about leads to it being unable to find process.ppu , which in my case is found here

/usr/lib64/fpc/2.6.4/units/x86_64-linux/fcl-process/process.ppu /usr/lib64/fpc/2.7.1/units/x86_64-linux/fcl-process/process.ppu

So I wrote /usr/lib64/fpc/etc/fpc.cfg thus:

#
-Fu/usr/lib64/fpc/$fpcversion/units/$fpctarget/*
#

And now Lazarus builds with no problem.

G.

Marc Weustink wrote 29 lines
Gennadiy Poryev wrote: > thank you, > > but my question was more about where to put fpc.cfg so that both > versions can use it properly, or, if that is not possible, where to > stuff different fpc.cfg's for the same purpose? > and what would be the basepath in either case? execute ppx64 -vut the last lines of the output list the patch searched for fpc.cfg In my case [0.004] Configfile search: /home/marc/.fpc.cfg [0.004] Configfile search: /home/marc/etc/fpc.cfg [0.004] Configfile search: /etc/fpc.cfg I also vaguely recall that the dir of the compiler is searched too, but isn't listed here (it might be a windows only thing or something from the past) Marc _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email