[fpc-pascal] How to compile program from command line on Linux?

Bart bartjunk64 at gmail.com
Mon Dec 16 14:55:21 CET 2024


On Mon, Dec 16, 2024 at 2:21 PM Bo Berglund via fpc-pascal
<fpc-pascal at lists.freepascal.org> wrote:


> Can this be done and in that case how?

Yes, of course it can be done.
Lazarus IDE just calls the compiler with the correct parameters ;-)

If you happen to have a compiled version of lazbuild on the computer
in question it's easy.
Just a lazbuild myproject (not sure if an extension must be given) should do it.
AFAIK you can also specify the build-mode (if your project has
buildmodes) on the commandline.

If you don't have lazbuild, then you have to figure out what to supply
mainly for the unit-paths that are needed (-Fu parameter) to built the
project.
Normally the IDE can tell you that, but you cannot access the IDE.
So you need the path to all units (where *.o and *.ppu) reside (for
e.g. LCL, LazUtils etc.

If you have access to any Lazarus on any PC you can get an idea of how
that looks for a similar project.
Goto Colpiler Options -> Show compiler options.
This will show all parameters that the IDE gives to the compiler,
including all unitpaths.

-- 
Bart


More information about the fpc-pascal mailing list