Recent

Author Topic: Compile on multiple distros of Linux?  (Read 827 times)

dodgebros

  • Full Member
  • ***
  • Posts: 167
Compile on multiple distros of Linux?
« on: January 21, 2025, 01:36:53 am »
I have Lazarus installed on Linux Mint.  I copied all the project files over from my Lazarus on Windows 7.  Once I compiled my "Windows" Lazarus project files on Linux Mint it worked perfectly on Mint.  BTW i am using the Ubuntu derivative of Mint.

As a test I installed the latest workstation version of Fedora in a virtual machine then copied the compiled program file from Mint to Fedora and made it executable.  When I double click on the compiled program file on Fedora, nothing happens.

I said all of that to ask this question....does one have to compile the Lazarus project on EACH Linux distro in order to get it to work?

Thanks,
TD

TRon

  • Hero Member
  • *****
  • Posts: 3923
Re: Compile on multiple distros of Linux?
« Reply #1 on: January 21, 2025, 02:05:23 am »
I said all of that to ask this question....does one have to compile the Lazarus project on EACH Linux distro in order to get it to work?
No but with some caveats (which probably makes the no answer a theoretical one unless knowing what you're doing).

The host platform must provide the dependencies that your application depends on. E.g. if you compiled your program for QT5 widgetset then it will ofc not run on a host that does not cater for that dependency.

Furthermore, wayland vs X11 can be an issue and in a similar fashion the version of libc which was build against.

The versions of the libraries that you build against are important (the host must be able to handle them).

Other than that, in theory, you should be good to go.

A GUI application can be invoked from a terminal and usually provide an error on what is missing. Detailed information can be obtained with strace.
« Last Edit: January 21, 2025, 02:09:19 am by TRon »
I do not have to remember anything anymore thanks to total-recall.

Thaddy

  • Hero Member
  • *****
  • Posts: 16516
  • Kallstadt seems a good place to evict Trump to.
Re: Compile on multiple distros of Linux?
« Reply #2 on: January 21, 2025, 06:31:40 am »
You only have to resolve the dependencies (and compile for the right cpu, of course)
Lazarus GUI applications can have *a lot* of dependencies, mainly the widget set.
Text mode applications or Daemons have very few to none.
The wayland vs X11 warning from TRon is something to be aware of, especially when you are not fully up-to-date:wayland is a moving target.
But I am sure they don't want the Trumps back...

dbannon

  • Hero Member
  • *****
  • Posts: 3212
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Compile on multiple distros of Linux?
« Reply #3 on: January 21, 2025, 09:28:37 am »
Guessing you have built a gtk2 app on your linux box, here are the libraries I declare in packaging as necessary for my (gtk2) app -

libgtk2.0-0, libcanberra-gtk-module, libnotify-bin,

I strongly doubt you need libnotify and you probably don't need libcanberra but my app complains if its not there (runs OK but grizzles).  So, probably, all you need is libgtk2.0-0 !

On fedora, possibly -

Code: Bash  [Select][+][-]
  1. $> sudo dnf install libgtk2.0-0 <enter>

There was a time when every distro included gtk2 by default but we have been getting signals that it is time to give up on it for some time.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Handoko

  • Hero Member
  • *****
  • Posts: 5386
  • My goal: build my own game engine using Lazarus
Re: Compile on multiple distros of Linux?
« Reply #4 on: January 22, 2025, 03:17:29 am »
As Windows, programs written using Linux may have library dependency issue. One can use ldd command to check which library is missing.

dodgebros

  • Full Member
  • ***
  • Posts: 167
<RESOLVED> Re: Compile on multiple distros of Linux?
« Reply #5 on: January 23, 2025, 05:44:44 am »
Guessing you have built a gtk2 app on your linux box, here are the libraries I declare in packaging as necessary for my (gtk2) app -

libgtk2.0-0, libcanberra-gtk-module, libnotify-bin,

I strongly doubt you need libnotify and you probably don't need libcanberra but my app complains if its not there (runs OK but grizzles).  So, probably, all you need is libgtk2.0-0 !

On fedora, possibly -

Code: Bash  [Select][+][-]
  1. $> sudo dnf install libgtk2.0-0 <enter>

There was a time when every distro included gtk2 by default but we have been getting signals that it is time to give up on it for some time.

Davo

That resolved the issue as the app now runs on fedora 41.   Thank you !!!

 

TinyPortal © 2005-2018