Sign in Join

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

Mailing lists / lazarus / 2010-10

Dual installation of FPC

18 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

patspiper

I have FPC-2.4.0 (fpc.cfg is in /etc) installed on my Ubuntu 10.04 system, and use exclusively Lazarus SVN which I continuously update and build from within the IDE without any issue. I tried to install FPC SVN:

I checked out the FPC trunk to ~/Programs/fpc/fpc-svn mkdir ~/Programs/fpc/fpc-2.5.1
cd ~/Programs/fpc/fpc-svn
make clean all install INSTALL_PREFIX=~/Programs/fpc/fpc-2.5.1

It created in ~/Programs/fpc/fpc-2.5.1 the following directories: bin: fpc and fpcmkcfg executables are here
lib/fpc/2.5.1 (contains ide, msg, and units directories as well as ppc386 executable)
share (contains doc directory)

cd ~/Programs/fpc/fpc-2.5.1/bin
fpcmkcfg > fpc.cfg
I added to the new fpc.cfg:
-Fu~/Programs/fpc/fpc-2.5.1/lib/fpc/$fpcversion/units/$fpctarget -Fu~/Programs/fpc/fpc-2.5.1/lib/fpc/$fpcversion/units/$fpctarget/* -Fu~/Programs/fpc/fpc-2.5.1/lib/fpc/$fpcversion/units/$fpctarget/rtl

At this stage, I did not use the new fpc.cfg, but edited instead the old fpc.cfg commenting out the old 3 -Fu lines and adding the new ones.

In terminal:
export PATH=~/Programs/fpc/fpc-2.5.1/lib/fpc/2.5.1:$PATH export PATH=~/Programs/fpc/fpc-2.5.1/bin:$PATH

At this stage, fpc -v shows 2.5.1

I launched Lazarus from the terminal (so that the exported paths persist): Lazarus env options:
Compiler path: ~/Programs/fpc/fpc-2.5.1/bin/fpc
FPC source directory: ~/Programs/fpc/fpc-svn/

I rebuilt the IDE which complained about lnet package not compiling and asking if I should remove it and showed 2 buttons: Remove and Yes!! (this is a bug).

I removed the package manually, and the IDE was built successfully showing 2.5.1 in the About box.

The question remains how to handle the paths and fpc.cfg so that Lazarus can use both FPC versions on demand (by changing the compiler path and FPC source directory entries).

Stephano

Reply by email

Thierry B.
to patspiper: I have FPC-2.4.0 (fpc.cfg is in /etc) installed on my Ubuntu 10.04 system, and use…

Le 22/10/2010 13:48, patspiper a ?crit :

Show quoted text 5 lines
The question remains how to handle the paths and fpc.cfg so that Lazarus can use both FPC versions on demand (by changing the compiler path and FPC source directory entries).

The best is to put all you fpcs under a root directory. Then in you ~/.fpc.cfg, just use $FPCVERSION so that it matches all versions. For example :

# searchpath for units and other system dependent things

-Fu/home/thierrybo/Sys/local/opt/fpc/$FPCVERSION/lib/fpc/$FPCVERSION/units/$FPCTARGET

-Fu/home/thierrybo/Sys/local/opt/fpc/$FPCVERSION/lib/fpc/$FPCVERSION/units/$FPCTARGET/*

-Fu/home/thierrybo/Sys/local/opt/fpc/$FPCVERSION/lib/fpc/$FPCVERSION/units/$FPCTARGET/rtl

Thierry B.

Reply by email

patspiper
to Thierry B.
Thierry B. wrote 15 lines
The best is to put all you fpcs under a root directory. Then in you ~/.fpc.cfg, just use $FPCVERSION so that it matches all versions. For example : # searchpath for units and other system dependent things -Fu/home/thierrybo/Sys/local/opt/fpc/$FPCVERSION/lib/fpc/$FPCVERSION/units/$FPCTARGET -Fu/home/thierrybo/Sys/local/opt/fpc/$FPCVERSION/lib/fpc/$FPCVERSION/units/$FPCTARGET/* -Fu/home/thierrybo/Sys/local/opt/fpc/$FPCVERSION/lib/fpc/$FPCVERSION/units/$FPCTARGET/rtl Thierry B.

That would require using FPC/Lazarus with root privileges...not recommended

I solved the fpc.cfg issue anyway by having the 2.4.0 config file in /etc, and 2.5.1's config file in ~/.fpc.cfg

However, another idea just came to my mind: Can #IFDEF within fpc.cfg be used to test the value of $FPCVERSION? This would allow conditional paths.

Reply by email

Thierry B.
to patspiper

Le 22/10/2010 21:27, patspiper a ?crit :

Show quoted text 20 lines
On 10/22/2010 09:39 PM, Thierry B. wrote: > The best is to put all you fpcs under a root directory. Then in you > ~/.fpc.cfg, just use $FPCVERSION so that it matches all versions. For > example : > > # searchpath for units and other system dependent things > > -Fu/home/thierrybo/Sys/local/opt/fpc/$FPCVERSION/lib/fpc/$FPCVERSION/units/$FPCTARGET > > > -Fu/home/thierrybo/Sys/local/opt/fpc/$FPCVERSION/lib/fpc/$FPCVERSION/units/$FPCTARGET/* > > > -Fu/home/thierrybo/Sys/local/opt/fpc/$FPCVERSION/lib/fpc/$FPCVERSION/units/$FPCTARGET/rtl > > > > Thierry B. > That would require using FPC/Lazarus with root privileges...not recommended

Uhm, I should have not used "a root directory" but "a base directory in you home folder" instead. No need to run Lazarus as root.

Show quoted text 13 lines
I solved the fpc.cfg issue anyway by having the 2.4.0 config file in /etc, and 2.5.1's config file in ~/.fpc.cfg However, another idea just came to my mind: Can #IFDEF within fpc.cfg be used to test the value of $FPCVERSION? This would allow conditional paths. -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

patspiper
to Thierry B.
Thierry B. wrote 29 lines
Le 22/10/2010 21:27, patspiper a ?crit : > On 10/22/2010 09:39 PM, Thierry B. wrote: > >> The best is to put all you fpcs under a root directory. Then in you >> ~/.fpc.cfg, just use $FPCVERSION so that it matches all versions. For >> example : >> >> # searchpath for units and other system dependent things >> >> -Fu/home/thierrybo/Sys/local/opt/fpc/$FPCVERSION/lib/fpc/$FPCVERSION/units/$FPCTARGET >> >> >> -Fu/home/thierrybo/Sys/local/opt/fpc/$FPCVERSION/lib/fpc/$FPCVERSION/units/$FPCTARGET/* >> >> >> -Fu/home/thierrybo/Sys/local/opt/fpc/$FPCVERSION/lib/fpc/$FPCVERSION/units/$FPCTARGET/rtl >> >> >> >> Thierry B. >> >> > That would require using FPC/Lazarus with root privileges...not recommended > Uhm, I should have not used "a root directory" but "a base directory in you home folder" instead. No need to run Lazarus as root.

And I did not check out the directories you mentioned thoroughly, as they indeed are in /home. So what you are saying is correct. However if you install FPC official release through Debian packages, you're pretty much stuck with an FPC installation in the root folder (which needs root privileges to be rebuilt).

Reply by email

Thierry B.
to patspiper

Le 23/10/2010 10:22, patspiper a ?crit :

Show quoted text 11 lines
>> > Uhm, I should have not used "a root directory" but "a base directory in > you home folder" instead. No need to run Lazarus as root. > > And I did not check out the directories you mentioned thoroughly, as they indeed are in /home. So what you are saying is correct. However if you install FPC official release through Debian packages, you're pretty much stuck with an FPC installation in the root folder (which needs root privileges to be rebuilt).

Correct, but after some times you are comfortable with compiling multiple versions
from sources/subversion and you can get rid off of your linux distribution Lazarus package,
so this not a problem anymore.

The oldest source I use is the "fixes" branche for the latest release (0.9.28).

Thierry B.

Reply by email

patspiper
to Thierry B.
Thierry B. wrote 10 lines
Correct, but after some times you are comfortable with compiling multiple versions from sources/subversion and you can get rid off of your linux distribution Lazarus package, so this not a problem anymore. The oldest source I use is the "fixes" branche for the latest release (0.9.28).

Fair enough. But how do you go by defining the paths? As far as I understand, the following two paths should be in the $PATH env variable: <basedir>/lib/fpc/$FPCVERSION
<basedir>/bin
or in your case:
/home/thierrybo/Sys/local/opt/fpc/$FPCVERSION/lib/fpc/$FPCVERSION /home/thierrybo/Sys/local/opt/fpc/$FPCVERSION/bin

Reply by email

Thierry B.
to patspiper

Le 23/10/2010 20:44, patspiper a ?crit :

Show quoted text 9 lines
> Fair enough. But how do you go by defining the paths? As far as I understand, the following two paths should be in the $PATH env variable: <basedir>/lib/fpc/$FPCVERSION <basedir>/bin or in your case: /home/thierrybo/Sys/local/opt/fpc/$FPCVERSION/lib/fpc/$FPCVERSION /home/thierrybo/Sys/local/opt/fpc/$FPCVERSION/bin

This is only needed if you build programs with freepascal, without Lazarus. If you use Lazarus to build all your freepascal programs, you only need to tell lazarus which freepascal compiler to use in environment options (compiler path).

When this compiler run, it will find correct library with the above paths in ~/.fpc.cfg, as $FPCVERSION will be replaced with 2.5.1 or 2.4.3 for example.

Here is for my directory layout:
http://a.yfrog.com/img291/7176/screenshot004jb.png

Thierry B.

Reply by email

patspiper
to Thierry B.
Thierry B. wrote 15 lines
This is only needed if you build programs with freepascal, without Lazarus. If you use Lazarus to build all your freepascal programs, you only need to tell lazarus which freepascal compiler to use in environment options (compiler path). When this compiler run, it will find correct library with the above paths in ~/.fpc.cfg, as $FPCVERSION will be replaced with 2.5.1 or 2.4.3 for example. Here is for my directory layout: http://a.yfrog.com/img291/7176/screenshot004jb.png Thierry B.

I tried your method, but had to point to ppc386 in compiler path instead of fpc to make it work. But still the IDE complained about not finding fpcres, which is usually in the path (/usr/bin).

Reply by email

Thierry B.
to patspiper

Le 24/10/2010 00:58, patspiper a ?crit :

Show quoted text 5 lines
> I tried your method, but had to point to ppc386 in compiler path instead of fpc to make it work. But still the IDE complained about not finding fpcres, which is usually in the path (/usr/bin).

I forgot about fpcres. If you installed FPC through Debian packages, it is in "fp-utils". If you only build it in you home directory, then copy/symlink it in /usr/bin/ from your local freepascal /bin/frcres directory.

For ppc386 i don't know, it's trange as fpc should detect your platform and use the right compiler. Here is what I use in one Lazarus setup :

Lazarus directory :
/home/thierrybo/Sys/local/opt/lazarus_svn/

Compiler path :
/home/thierrybo/Sys/local/opt/fpc/2.4.3/bin/fpc

FPC source directory :
/home/thierrybo/Sys/local/opt/fpc/fpsrc/2.4.3/

Thierry B.

Reply by email

patspiper
to Thierry B.
Thierry B. wrote 5 lines
I forgot about fpcres. If you installed FPC through Debian packages, it is in "fp-utils". If you only build it in you home directory, then copy/symlink it in /usr/bin/ from your local freepascal /bin/frcres directory.

Good idea.
Another solution is to create a script which changes the $PATH env variable and launches lazarus. That way, you will use the utils of the FPC version in question. On the other hand, Symlinks can become orphaned once FPC versions are added and deleted.

Show quoted text 14 lines
For ppc386 i don't know, it's trange as fpc should detect your platform and use the right compiler. Here is what I use in one Lazarus setup : Lazarus directory : /home/thierrybo/Sys/local/opt/lazarus_svn/ Compiler path : /home/thierrybo/Sys/local/opt/fpc/2.4.3/bin/fpc FPC source directory : /home/thierrybo/Sys/local/opt/fpc/fpsrc/2.4.3/ Thierry B.

I am not sure what's going on, but I have found 2 bugs in the IDE which could be the partial cause of this havoc:
http://bugs.freepascal.org/view.php?id=17700
http://bugs.freepascal.org/view.php?id=17701

Reply by email

Thierry B.
to patspiper

Le 24/10/2010 12:01, patspiper a ?crit :

Show quoted text 10 lines
On 10/24/2010 11:14 AM, Thierry B. wrote: > > For ppc386 i don't know, it's trange as fpc should detect your platform > and use the right compiler. Here is what I use in one Lazarus setup : > > The platform should be detected indeed. However how will it find out which ppc386 to use (each FPC version has a ppc386)? --

It will only use those in the same directory as the fpc you set in Lazarus "Compiler path". Following my previous post as I set :

Compiler path :
/home/thierrybo/Sys/local/opt/fpc/2.4.3/bin/fpc

it will look only in Compiler path :
/home/thierrybo/Sys/local/opt/fpc/2.4.3/bin/

Again, this works only if you use Lazarus to build all your freepascal programs, and have no fpc stuff in my path :

PATH=/home/thierrybo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/lampp/bin

Thierry B.

Reply by email

patspiper
to Thierry B.
Thierry B. wrote 14 lines
It will only use those in the same directory as the fpc you set in Lazarus "Compiler path". Following my previous post as I set : Compiler path : /home/thierrybo/Sys/local/opt/fpc/2.4.3/bin/fpc it will look only in Compiler path : /home/thierrybo/Sys/local/opt/fpc/2.4.3/bin/ Again, this works only if you use Lazarus to build all your freepascal programs, and have no fpc stuff in my path : PATH=/home/thierrybo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/lampp/bin

So you have put ppc386 in the same folder as the fpc executable?

My ppc386 is in .../fpc/2.5.1/lib/fpc/2.5.1 whereas fpc is in fpc/2.5.1/bin

Reply by email

Thierry B.
to patspiper

Le 24/10/2010 20:20, patspiper a ?crit :

Show quoted text 6 lines
> > So you have put ppc386 in the same folder as the fpc executable? My ppc386 is in .../fpc/2.5.1/lib/fpc/2.5.1 whereas fpc is in fpc/2.5.1/bin

Argl, you are right to insist. After each freepascal build from source, , you have to link fpcres as I did AND link
/fpc/X.X.X/lib/fpc/X.X.X/ppcXXX to /fpc/X.X.X/bin/ppcXXX (although I did only once for fpcres).

As I use a script to build FPC and Lazarus (inspired from various sources here), I forgotten this step. Here is an excerpt

ake clean all $COMMONOPTS PP=$FPCSTART > ${LOGDIR}/build_fpc_log.txt 2>&1 if [ ! $? = 0 ] ; then
echo Grrr, failed again
else
make install $COMMONOPTS INSTALL_PREFIX=$INSTALLDIR PP=$SRCDIR/compiler/$PPCNAME > ${LOGDIR}/install_fpc_log.txt 2>&1

  if [ ! $? = 0 ] ; then
    echo INSTALL failed | tee -a ${LOGDIR}/outcome.txt
  else
    ln --symbolic $INSTALLDIR/lib/fpc/$FPCNEWVERSION/$PPCNAME

$INSTALLDIR/bin/$PPCNAME <--------------------------------------------- echo Everything _should_ be fine.| tee -a ${LOGDIR}/outcome.txt fi
fi

Thierry B.

Reply by email

patspiper
to Thierry B.
Thierry B. wrote 26 lines
Argl, you are right to insist. After each freepascal build from source, , you have to link fpcres as I did AND link /fpc/X.X.X/lib/fpc/X.X.X/ppcXXX to /fpc/X.X.X/bin/ppcXXX (although I did only once for fpcres). As I use a script to build FPC and Lazarus (inspired from various sources here), I forgotten this step. Here is an excerpt ake clean all $COMMONOPTS PP=$FPCSTART> ${LOGDIR}/build_fpc_log.txt 2>&1 if [ ! $? = 0 ] ; then echo Grrr, failed again else make install $COMMONOPTS INSTALL_PREFIX=$INSTALLDIR PP=$SRCDIR/compiler/$PPCNAME> ${LOGDIR}/install_fpc_log.txt 2>&1 if [ ! $? = 0 ] ; then echo INSTALL failed | tee -a ${LOGDIR}/outcome.txt else ln --symbolic $INSTALLDIR/lib/fpc/$FPCNEWVERSION/$PPCNAME $INSTALLDIR/bin/$PPCNAME<--------------------------------------------- echo Everything _should_ be fine.| tee -a ${LOGDIR}/outcome.txt fi fi Thierry B.

It's a relief for me to see that I am on the right track.

Your script seems quite interesting and well thought. What I have done is create a script for each FPC version that sets $PATH and launches Lazarus.

Thanks!

Reply by email

patspiper
to Thierry B.: Le 23/10/2010 20:44, patspiper a ?crit : This is only needed if you build programs with…
Thierry B. wrote
Le Here is for my directory layout: http://a.yfrog.com/img291/7176/screenshot004jb.png

I have setup FPC 2.4.2 for cross compilation to win32. However, crosscompiling 2.5.1 is aborted due to errors.
Have you tried that?

make all LINKSMART=1 CREATESMART=1
make[4]: Entering directory
`/home/me/Programs/fpc/fpsrc/2.5.1/packages/hermes' /home/me/Programs/fpc/cross_fpc/cross/bin/i686-cygwin-as --32 -o units/i386-win32/mmx_clr.o src/i386/mmx_clr.as
make[4]: /home/me/Programs/fpc/cross_fpc/cross/bin/i686-cygwin-as: Command not found
make[4]: *** [mmx_clr.o] Error 127
make[4]: Leaving directory
`/home/me/Programs/fpc/fpsrc/2.5.1/packages/hermes' make[3]: *** [fpc_smart] Error 2
make[3]: Leaving directory
`/home/me/Programs/fpc/fpsrc/2.5.1/packages/hermes' make[2]: *** [hermes_smart] Error 2
make[2]: Leaving directory `/home/me/Programs/fpc/fpsrc/2.5.1/packages' make[1]: *** [packages_smart] Error 2
make[1]: Leaving directory `/home/me/Programs/fpc/fpsrc/2.5.1' make: *** [build-stamp.i386-win32] Error 2

Reply by email