Recent

Author Topic: Linux : two Lazarus setup with fpc 2.2 for one and 2.4 for the other  (Read 11814 times)

thierrybo

  • Full Member
  • ***
  • Posts: 143
Hi,

I use since a while regular stable Lazarus 0.9.26 then 0.9.28 and fpc 2.2.x from Freepascal Ubuntu repository with freepascal. I build also Lazarus svn in my home folder, both use fpc 2.2.

Since we have to use fpc 2.4 for Lazarus svn, I install the new version also in my home directory. I don't know how to easily setup both Lazarus to use their own fpc.cfg version.

Freepascal installer add .fpc.cfg to my home directory, with paths to fpc 2.4. I can't let this file here since it will be used by my regular Lazarus. However if svn Lazarus don't find it, it will use the one in /etc/, and this is not good also.

For the moment, the only workaround I found is unchecking "Use standard compiler config file" in Compiler options and use "Use additional compiler config file" instead ... but this is a pain, because these are per project options, so I have always to think for this.

To my mind it would be nice to add also the default fpc.cfg choice to LAzarus general option.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2649
Re: Linux : two Lazarus setup with fpc 2.2 for one and 2.4 for the other
« Reply #1 on: January 13, 2010, 02:00:20 am »
2 options:

1) put the fpc.cfg in the same dir as the compiler.

2) install the fpc versions in the same base dir so you can use $fpcversion in you cfg like:
Code: [Select]
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/*
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/rtl
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

thierrybo

  • Full Member
  • ***
  • Posts: 143
Re: Linux : two Lazarus setup with fpc 2.2 for one and 2.4 for the other
« Reply #2 on: January 13, 2010, 01:19:25 pm »
Thanks, I will try later.

Some comments:

 About 1) , following sources I read do not include de same directory as the compiler as a valid path **for Linux platform**. From "man fpc.cfg" :

Quote
The compiler looks for the fpc.cfg file in the following places :

   - Under Linux and unix

      - The current directory.
      - Home directory, looks for .fpc.cfg
      - The directory specified in the environment
           variable PPC_CONFIG_PATH, and if it's not
           set under compilerdir/../etc.
      - If it is not yet found: in /etc.


   - Under all other OSes:

      - The current directory.
      - The directory specified in the environment
           variable  PPC_CONFIG_PATH.
      - The directory where the compiler binary is.

About 2) I  did dot tried to install system wide with the script because I was afraid it erase some fpc 2.2 files but ... second question. Where come from $fpcversion ?

thierrybo

  • Full Member
  • ***
  • Posts: 143
Re: Linux : two Lazarus setup with fpc 2.2 for one and 2.4 for the other
« Reply #3 on: January 13, 2010, 07:56:54 pm »
Yep,

I am definitively out of luck with FPCVERSION or FPCVER. Reading docs or googling I did not found *how* Lazarus resolves this macro, where it looks this information. 0.9.26 release notes says
Quote
FPC source directory can now use IDE macros, like the new FPCVer, so that switching the compiler automatically switches the source directory
  %)

Also, I can't install fpc 2.4 in the same base dir as 2.2 because of freepascal installer. To get fpc 2.4 installed in /usr/lib/fpc/2.4.0/ next to 2.2.4, we have to set base install directory to usr/ so that directories bin/ man/ lib/ and share/ go to the proper location, and doing that will erase all 2.2.4 binaries in /usr/bin/  :o

So in summary I can't use the first solution, nor the second one. So I started to use this workaround: instead of running svn lazarus with 
Code: [Select]
startlazarus --pcp=~/.lazarussvn --scp=~/.lazarussvn I use a shell script that :

- copy my fpc2.4.0.cfg file to ~/.fpc.cfg
- start svn lazarus as before
- delete ~/.fpc.cfg when I exit Lazarus

This way it use the right file and I can also run regular lazarus normally. I just can't run BOTH simultaneously.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2649
Re: Linux : two Lazarus setup with fpc 2.2 for one and 2.4 for the other
« Reply #4 on: January 13, 2010, 11:31:05 pm »
Thanks, I will try later.

Some comments:

 About 1) , following sources I read do not include de same directory as the compiler as a valid path **for Linux platform**. From "man fpc.cfg" :


ah, i only use this option on win32, on linux i use option 2

Quote
About 2) I  did dot tried to install system wide with the script because I was afraid it erase some fpc 2.2 files but ... second question. Where come from $fpcversion ?

The compiler will fill in this when reading fpc.cfg
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

thierrybo

  • Full Member
  • ***
  • Posts: 143
Re: Linux : two Lazarus setup with fpc 2.2 for one and 2.4 for the other
« Reply #5 on: January 14, 2010, 01:01:45 pm »
The compiler will fill in this when reading fpc.cfg

 :D so it's like "a dog chasing its tail'

arbelest

  • New Member
  • *
  • Posts: 15
Re: Linux : two Lazarus setup with fpc 2.2 for one and 2.4 for the other
« Reply #6 on: January 14, 2010, 01:49:35 pm »
I'm using ubuntu 9.04 and install fpc 2.2.2-8 with synaptic.
Now i'm using lazarus 0.9.27 and lazarus 0.9.28.2, both compile (but not installed) from source.
I have download and compile (but not install) fpc 2.2.4 and 2.4.0, both 're from source.
So lazarus 0.9.27 <--> fpc 2.2.2-8
lazarus 0.9.28.2 <--> fpc 2.4.0

About fpc, this is what i've done, first installed fpc 2.2.2-8 with synaptic, compile fpc 2.2.4 using fpc 2.2.2-8, and last compile fpc 2.4.0 using fpc 2.2.4.

I've modify fpc.cfg (/etc/fpc.cfg) like this:
Note :
   fpc 2.2.4 extracted in this path :  /home/mine/fpc/fpc-2.2.4
   fpc 2.4.0 extracted in this path :  /home/mine/fpc/fpc-2.4.0

....
# -----------------------
#IFDEF VER2_2_2         ### <<=======
# ------------------------------------------------------------------------------------
...
# searchpath for units and other system dependent things
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/*
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/rtl

...

# ------------------------------------------------------------------------
#ELSE           
   #IFDEF VER2_2_4     ### <<=======
   -Fu/home/mine/fpc/fpc-2.2.4/
   -Fu/home/mine/fpc/fpc-2.2.4/*/units/$fpctarget
   -Fu/home/mine/fpc/fpc-2.2.4/packages/*/units/$fpctarget
   #ENDIF
   #ELSE
       #IFDEF VER2_4_0   ### <<=======
       -Fu/home/mine/fpc/fpc-2.4.0/
       -Fu/home/mine/fpc/fpc-2.4.0/*/units/$fpctarget
       -Fu/home/mine/fpc/fpc-2.4.0/packages/*/units/$fpctarget
       #ENDIF
  #ENDIF
#ENDIF

Don't forget setting each lazarus compiler, compiler source path etc.

It's maybe not best solution, but with this, you can have multiple fpc and lazarus.

Note : sorry for my bad english



Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2649
Re: Linux : two Lazarus setup with fpc 2.2 for one and 2.4 for the other
« Reply #7 on: January 14, 2010, 11:08:32 pm »
The compiler will fill in this when reading fpc.cfg

 :D so it's like "a dog chasing its tail'

No since you decide which compiler to use
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

thierrybo

  • Full Member
  • ***
  • Posts: 143
Re: Linux : two Lazarus setup with fpc 2.2 for one and 2.4 for the other
« Reply #8 on: January 15, 2010, 11:17:21 pm »
Arbelest,

thanks, it works, this is what I want. I just did it in ~/.fpc.cfg and leaved /etc/fpc.cfg unmodified. I think it is the only solution on linux.


arbelest

  • New Member
  • *
  • Posts: 15
Re: Linux : two Lazarus setup with fpc 2.2 for one and 2.4 for the other
« Reply #9 on: January 16, 2010, 01:47:14 am »
thierrybo,

Bravo..
I not using .fpc.cfg yet, and i think what you've done is better, so I'll try it latter.
Thanks.

 

TinyPortal © 2005-2018