Recent

Author Topic: Lazarus features in a non-graphical environment  (Read 781 times)

jollytall

  • Sr. Member
  • ****
  • Posts: 357
Lazarus features in a non-graphical environment
« on: April 24, 2024, 11:53:17 am »
I have a command line program running on a Linux server somewhere far in a datacenter. It uses Indy for networking. The program was running for a long time, but now I needed to make some cosmetic changes, but I could not compile the source, and later could not run the executable. Details are in a Networking thread: https://forum.lazarus.freepascal.org/index.php/topic,67027.0.html

Now I made some more checks and came across a number of problems:
- Paweld recommended to add Interfaces to the uses clause. After doing so, my program with Indy compiled but the executable got much-much larger (13.2MB instead of 3.5MB). I checked the Interfaces unit and it is related to gtk2 and forms, although as said above my program is a service running with no GUI, and even more not even accessing a terminal. So, I am totally confused why adding Interfaces was necessary to use Indy.
- Nonetheless, I can live with the extra large executable, but it did not run. The reason apparently is that the server is an older Linux than my Desktop, so the program does not have the right libraries. It is a bit bothering that FPC/Lazarus can cross-compile from Linux to e.g. Windows, but cannot cross-compile it to another Linux. Can there be an easy solution?

But then again, I can also live with this, if I compile the program on the server (sub-optimal solution, but anyway). However, I do not know how to do that. I have IndyLaz and other packages added as required packages in the Project Inspector of Lazarus. Although, I did compile other programs with FPC only, those were simpler ones. I do not know, how to do an FPC compilation, using these kind of Lazarus features. It is obvious that I cannot have Lazarus running, but then what sort-of makefile or config file is needed to compile Lazarus projects with FPC only.

Can you help in this last question, but would also be happy to get comments on the Interfaces question as well (the Linux version was detailed in the other thread, but any better idea is again welcome).

Laksen

  • Hero Member
  • *****
  • Posts: 785
    • J-Software
Re: Lazarus features in a non-graphical environment
« Reply #1 on: April 24, 2024, 03:46:15 pm »
It is a bit bothering that FPC/Lazarus can cross-compile from Linux to e.g. Windows, but cannot cross-compile it to another Linux. Can there be an easy solution?
Likely not.
I think that sadly this is seen as a "feature" of Linux that you are forced to recompile on a target machine once your project requires sufficiently advanced features (dynamic linking mostly). I don't think this can realistically be fixed from pascal's side

Lutz Mändle

  • Jr. Member
  • **
  • Posts: 72
Re: Lazarus features in a non-graphical environment
« Reply #2 on: April 24, 2024, 05:26:34 pm »
I do not know, how to do an FPC compilation, using these kind of Lazarus features. It is obvious that I cannot have Lazarus running, but then what sort-of makefile or config file is needed to compile Lazarus projects with FPC only.

If your project has a lpi-file try lazbuild, a typical command to compile one of my projects is:

lazbuild -B --no-write-project --ws=nogui <projectname>.lpi

This can be done from a ssh login prompt without a graphical environment.

 

TinyPortal © 2005-2018