Recent

Author Topic: Is there a way of obtaining the exact command used by Lazarus for compilation?  (Read 1908 times)

Joseph

  • New Member
  • *
  • Posts: 14
Hello everyone!

I have a program written in Pascal which is then used in an R interface. The R program calls the compilation file and does what it has to do.

For some reason, I'd like to be able to recompile the source code when I modify it, but directly from the command line (to be more precise, from R which then uses the command line), and not from the Lazarus environment.

I've tried a few things that look more or less like this:

Code: Bash  [Select][+][-]
  1. fpc -gl -godwarfsets -vl -vd -FEsrc/compiled/ -FUsrc/source_pascal/lazarus/ src/source_pascal/lazarus/lifelihoodC2023.lpr

But the compiled file is different from the one I get when compiling from Lazarus (which is sort of expected because I've probably set a lot of project options that weren't made explicit in the last command).

So my question is: is there any way of knowing what command Lazarus is using under the bonnet so that I can recompile without having to run Lazarus? Is there any downside to doing this?

I hope my question is self-explanatory and understandable.




korba812

  • Sr. Member
  • ****
  • Posts: 441
If you want to build from command line then use 'lazbuild' tool.
https://wiki.freepascal.org/lazbuild

Joseph

  • New Member
  • *
  • Posts: 14
Cool, I didn't know about this tool. I'm going to have a look at it right away.

Bart

  • Hero Member
  • *****
  • Posts: 5465
    • Bart en Mariska's Webstek
If you go to Compiler Options, there's a button "Show Options" that will show you all the options passed to the compiler.

Bart

TRon

  • Hero Member
  • *****
  • Posts: 3622
If you want to build from command line then use 'lazbuild' tool.
Which doesn't imply that you can't compile a Lazarus project with the FPC commandline compiler, it is just much harder to do it right.

It really is recommended to use lazbuild for compiling Lazarus projects to avoid the complexity.

2 cents.
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

MarkMLl

  • Hero Member
  • *****
  • Posts: 8007
If you want to build from command line then use 'lazbuild' tool.
Which doesn't imply that you can't compile a Lazarus project with the FPC commandline compiler, it is just much harder to do it right.

It really is recommended to use lazbuild for compiling Lazarus projects to avoid the complexity.

2 cents.

I agree, but it's also worth echoing Bart's comment about asking the IDE what command it's going to use.

However for relatively simple programs /particularly/ if I'm putting them on e.g. Github I prefer to also provide a makefile as the de-facto standard build organisation, and that particularly applies to a program that is intended to run from the command line rather than graphically. Hence e.g. https://github.com/MarkMLl/Contec_cms50dplus/blob/main/cms50dplus4v6/Makefile

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Joseph

  • New Member
  • *
  • Posts: 14
If you go to Compiler Options, there's a button "Show Options" that will show you all the options passed to the compiler.

Thanks! That's exactly what I was looking for (:

n7800

  • Full Member
  • ***
  • Posts: 171
If you are compiling a very simple console application, fpc will do. But as soon as you want to compile something more complex (with many package dependencies and using build modes), you will not be able to do without lazbuild. There is no point in manually compiling each package with certain parameters, and in a certain order - lazbuild will do everything for you, and even multithreaded.

So I don't see any point in preferring fpc to lazbuild - they are both console and both can be used in the makefile, as it is done in the IDE's makefile.

 

TinyPortal © 2005-2018