Forum > Windows (32/64)
Lazarus portable?
sl23:
Here is what I have done:
I tried extracting Lazarus installer for portable use, it worked, but doesn't create the fpc.cfg file. I didn't know how to get around that, so I then installed it via Sandboxie-plus. This basically done the same thing, but I don't know what registry settings were created. I then downloaded the WinPenPack X-Lazarus, which is way out of date now, then moved the Sandboxed install to the new location. I am having several issues, which I have found are due to the fpc.cfg settings not being correct.
I searched here for topics on this and nothing I found is answering my questions. Sorry if this has been gone through before, but I am new to Lazarus and programming. I have no idea how to use the app but want to learn.
So using AI, I have spent nearly five hours troubleshooting why I cannot compile and the upshot is that relative paths are meant to be supported but are not working in the fpc.cfg file, according to GitHub Copilot! Yeah, I know, but I have no other way to sort it out, not quickly, forums tend to be slow in response times, and I just wanted to get on and get it sorted.
Anyway, from what I see, some variables are used to create relative paths like the $FPCVERSION one for example. Are there any other variables I can use for relative paths?
I was given this as a relative path by Copilot, but it doesn't seem to work:
-Fu..\..\source\packages\rtl-objpas\src\inc
Do those types of relative paths work in the fpc.cfg file? I just want the drive letter removed as the location will be static on a USB device. But if there is a way to completely make the app and locations fully portable, I would like to know more.
I guess the question I wanted to ask has already been answered and is a resounding no? See ing as it hasn't happened in the last 15 years or so. I see posts about making Lazarus portable, but seems little has been done about making it natively portable. Is that a possibility? Would the dev's ever consider making the app fully portable?
Thanks and apologies for repeating what has likely been covered in previous posts! I did try the search but found little of help.
Handoko:
Hello sl23,
Welcome to the forum.
I haven't tried but I remember there were several success attempts to create portable version of Lazarus. Try search the forum, you should find the information you need.
wp:
I have this one in my bookmarks, but never tried it myself: https://github.com/JoeJoeTV/startLazarusPortable
As for fpc.cfg, did you try the fpcmkcfg utility? Maybe this batch file helps (you are on Windows, aren't you?).
--- Code: ---set FPC_DEST_DIR=j:\Lazarus\fpc-main-32bit
set BIN_DIR=bin\i386-win32
set FPC_BIN_DIR=%FPC_DEST_DIR%\%BIN_DIR%
fpcmkcfg -d basepath=%FPC_DEST_DIR% -o %FPC_BIN_DIR%\fpc.cfg
--- End code ---
But besides that, I think paths must be adjusted also in the Lazarus configuration files?
Cascade:
I've considered writing a StartLazarus type of app that would first check to see whether Lazarus has moved before launching the main IDE. If so it would run a big recursive search and replace to update all the paths. But that would be a bit of a blunt brute force approach, and makes the assumption of a self-contained FpcUpDeluxe kind of install to start with.
I think it might be really neat if at some future point FPC and Lazarus referenced a single Base path each in their config files - and used that throughout. That way only a couple of paths entries would need updating whenever the app is moved. That could make portability viable. Not sure I've explained that well.
marcov:
--- Quote from: Cascade on November 04, 2025, 08:22:27 pm ---I've considered writing a StartLazarus type of app that would first check to see whether Lazarus has moved before launching the main IDE.
--- End quote ---
I once did something like that: http://www.stack.nl/~marcov/Lazarus.bat
--- Quote ---@echo off
rem
rem Simple script to relocate lazarus to use the current driveletter as
rem path, and put basic portable app support in lazarus.
rem
rem Assumes lazarus is in drvletter:\lazarus and config in
rem $lazarusdir/config
rem
rem For this to work, everything should be relative wrt $(lazarusdir)
rem inside the IDE. If packages work is currently untested
Set DRV_LETTER=%cd:~0,1%:
set LAZARUSDIR=%DRV_LETTER%\lazarus
set FPCROOTDIR=%LAZARUSDIR%\fpc\2.6.0
set FPCBINDIR=%FPCROOTDIR%\bin\i386-win32
set LAZARUSCONFIG=%LAZARUSDIR%\config
for %%i in (%LAZARUSDIR%\fpc\*) do set ALTFPCROOTDIR=%%i
echo %ALTFPCROOTDIR%
%DRV_LETTER%
cd \
REM The next on one line
%FPCBINDIR%\fpcmkcfg -d basepath=%FPCROOTDIR% > %FPCBINDIR%\fpc.cfg
cd %LAZARUSDIR%
rem startlazarus? untested as yet
rem should later get --lazarusdir=%LAZARUSDIR% if mantis 15741 (0.9.30+) is committed
rem
Lazarus.exe --primary-config-path=%LAZARUSCONFIG% --lazarusdir=%LAZARUSDIR%
--- End quote ---
It does require a portable base install though, so that the XML files are populated with paths relative to $lazarusdir
--- Quote ---I think it might be really neat if at some future point FPC and Lazarus referenced a single Base path each in their config files - and used that throughout. That way only a couple of paths entries would need updating whenever the app is moved. That could make portability viable. Not sure I've explained that well.
--- End quote ---
fpc.cfg paths are afaik relative to the location of fpc.cfg.
Navigation
[0] Message Index
[#] Next page