Recent

Author Topic: Portable verion of FPC and Lazarus  (Read 2715 times)

paweld

  • Hero Member
  • *****
  • Posts: 1700
Re: Portable verion of FPC and Lazarus
« Reply #45 on: June 28, 2026, 09:37:51 am »
In my previous post, I provided a link to a solution: https://gitlab.com/FpTuxe/lazatogo, which works on Windows and Linux (I haven't tested it myself). If you don't want to use it, you can review the code and see what needs to be changed to make your Lazarus/FPC installation work in a different location.

To move a working Windows installation to a different location, you need to change the paths in the following files:
- fpc.cfg - I generate a new file using:
Code: [Select]
cd d:\new_laz_path\fpc\3.2.3\bin\x86_64-win64
fpcmkcfg -d basepath=d:\new_laz_path\fpc\3.2.3\ -o .\fpc.cfg
- in all configuration files (located in the configuration directory), especially the environmentoptions.xml file, which contains paths to the compiler, FPC sources, the make executable, etc. Note: The packagefiles.xml file contains paths to installed components - however, if these components are located in the Lazarus directory, the paths are relative; otherwise, they are absolute paths.

Also note that Lazarus must be run with the pcp parameter specifying the path to the configuration directory - another way is to create a lazarus.cfg file with the following content:
Code: [Select]
--primary-config-path=/path/to/your/config_dir
I’m not a Linux expert, but from what I’ve gathered from forum posts, to avoid any issues on Linux with “non-standard” paths, you shouldn’t install the Lazarus and FPC from packages - deb, rpm, etc., whether local or remote (repositories) - but only from source. For this purpose, I use the program fpcupdeluxe: https://github.com/LongDirtyAnimAlf/fpcupdeluxe . But you can also do it yourself: https://wiki.freepascal.org/Installing_the_Free_Pascal_Compiler#Installing_from_source_on_BSD/Linux and https://wiki.lazarus.freepascal.org/Getting_Lazarus#Compiling_and_running_Lazarus
Best regards / Pozdrawiam
paweld

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12640
  • Debugger - SynEdit - and more
    • wiki
Re: Portable verion of FPC and Lazarus
« Reply #46 on: June 28, 2026, 10:10:54 am »
I am not sure from your answer if you solved the FPC standalone issues.

I.e. if you call fpc, on the command line, and you do give it the proper fpc.cfg => does it work? And can you (as I believe your goal is) move the entire fpc folder to a different location, and will it still work? Or do you then need to rewrite the fpc.cfg? 

Because as I said, all of my fpc.cfg have hardcoded fully specified path in them. They aren't "installed" as by "using the installer", but they are "configured" to live on the folder into which I placed them. (and I guess for your purpose that is already an issue)....

That is also why changning paths for fpc branches is quite limited, assuming fpc switcher only is required, proper src version path seems to be xxx/fpcsrc/FPCVER etc, etc.

But I do not see anywhere it is specified usage of multiple versions of FPC and Lazarus and that is the problem. No parameters for using specific fpc cfg in Lazarus...

I wouldn't mind seeing some additions in the IDE, but don't have the time to do myself

1) A coupling between the fields that specify the "compiler" and the "rtl sources" => so that if one changes to another compiler, the source location updates too. Currently that is limited to IDE macros. Which is ok for many cases but not all.
But such a coupling **must have** proper ways of maintaining them => that is a lot of stuff to add.

2) (An addon) that allows to manage the content of the dropdowns those setting fields have....

3) Some way of either:
- specifying an fpc.cfg
- giving arbitrary extra command line args, on a global scope (for all projects, as part of the compiler) // that probably be on add-on, since it may cause more confusion than good

To me, none of them are important, but rather just niceties.

Fred vS

  • Hero Member
  • *****
  • Posts: 3958
    • StrumPract is the musicians best friend
Re: Portable verion of FPC and Lazarus
« Reply #47 on: June 28, 2026, 11:52:51 am »
If you want a out-of-the-box solution, use fpc-ootb. This package uses the fpc.cfg file located in the same directory as the fpc executable.
Any other solution is a workaround and will not work properly.
« Last Edit: June 28, 2026, 11:55:27 am by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

backprop

  • Guest
Re: Portable verion of FPC and Lazarus
« Reply #48 on: June 28, 2026, 05:27:47 pm »
I have removed completely FPC 3.2.2 installation package (with remove --purge) and all related files as fp-*. fpc.cgf and fppcfg dir. Now 3.3.1 I have made to recomile Lazarus 4.99  can't compile anything alone, even that simple example which show MACRO FPC_FULLVERSION which correctly show 3.3.1 before...

It search system.pp in /usr directory which never existed... Well, more issues now to fix...

Code: Pascal  [Select][+][-]
  1. xxx/fpc/3.3.1/lib/fpc/3.3.1/ppcx64 FPCVersion_Test.lpr -va
  2.  

All in all, this is pure mess.
« Last Edit: June 28, 2026, 05:34:29 pm by backprop »

Weiss

  • Sr. Member
  • ****
  • Posts: 257
Re: Portable verion of FPC and Lazarus
« Reply #49 on: June 29, 2026, 01:34:57 pm »
I.e. if you call fpc, on the command line, and you do give it the proper fpc.cfg => does it work? And can you (as I believe your goal is) move the entire fpc folder to a different location, and will it still work? Or do you then need to rewrite the fpc.cfg? 

Because as I said, all of my fpc.cfg have hardcoded fully specified path in them. They aren't "installed" as by "using the installer", but they are "configured" to live on the folder into which I placed them. (and I guess for your purpose that is already an issue)....


I am looking at FPC.cfg file. Will it be enough to change paths in cfg file manually? Say, for example, I move FPC from C drive to a folder on G drive, will it do if I change
Code: Pascal  [Select][+][-]
  1. FrC:\FPC\***
to
Code: Pascal  [Select][+][-]
  1. FrG:\myFolder\FPC\***

and do the same to all other paths (FuC's FDC etc)? I did not read the entire thread, sorry if it was covered already. I am interested in re-locating FPC only, not Lazarus.

cheers

 
« Last Edit: June 29, 2026, 01:54:26 pm by Weiss »

 

TinyPortal © 2005-2018