What is the difference between a binary file on different OS?

Just starting out? Need help? Post your questions and find answers here.
AZJIO
Addict
Addict
Posts: 2241
Joined: Sun May 14, 2017 1:48 am

What is the difference between a binary file on different OS?

Post by AZJIO »

If I compiled a program on PureBasic v6.21 on different Linuxes (Arch, Mint, Fedora), how will they differ? The source code is the same and is converted to the same machine code. The files are different, sometimes they don't even run on another OS. Does the compiler import data from the current OS? Why is there such a difference?
User avatar
TI-994A
Addict
Addict
Posts: 2772
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: What is the difference between a binary file on different OS?

Post by TI-994A »

AZJIO wrote: Sun Nov 30, 2025 7:42 amWhy is there such a difference?
Although they all implement the common Linux kernel, each distro is compiled differently, and with different dependencies as well.

So, the toolchains, build configs, graphic systems, etc, would work differently.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
AZJIO
Addict
Addict
Posts: 2241
Joined: Sun May 14, 2017 1:48 am

Re: What is the difference between a binary file on different OS?

Post by AZJIO »

The GTK function call is compiled, but GTK itself is not added to the compiled file.
If you compile a function call, it's not the same as compiling different versions of GTK
infratec
Always Here
Always Here
Posts: 7707
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: What is the difference between a binary file on different OS?

Post by infratec »

You can use ldd to see the different needed/used libraries.
User avatar
mk-soft
Always Here
Always Here
Posts: 6432
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: What is the difference between a binary file on different OS?

Post by mk-soft »

There are different kernel versions for Linux. Therefore, there are also three different PureBasic versions for Linux.

The programme should therefore be compiled to match the Linux kernel version.
GTK-3 is still available on all versions. This means that the standard functions should run on the target system.

Exceptions may be OpenGL and Movie.
In this case, the missing runtime libraries must be installed on the target system.
Check this with "ldd" on the target system.

Unfortunately, the systray (libappindicator3-1) no longer works with Wayland. However, PureBasic is not alone in this. Other apps no longer work either.

Two different versions are also required for Linux Raspberry. One for Debian 12 and one for Debian 13 because of the WebGadget.
;)
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
infratec
Always Here
Always Here
Posts: 7707
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: What is the difference between a binary file on different OS?

Post by infratec »

The kernel is not guilty :wink:

Else all programs needs to available double if you boot for example with a 5. kernel instead of a 6. kernel after you updated your distribution.
User avatar
mk-soft
Always Here
Always Here
Posts: 6432
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: What is the difference between a binary file on different OS?

Post by mk-soft »

infratec wrote: Mon Dec 01, 2025 8:57 am The kernel is not guilty :wink:

Else all programs needs to available double if you boot for example with a 5. kernel instead of a 6. kernel after you updated your distribution.
Okay, the kernel is not to blame.
But usually, after a new kernel is released, there is also a new distribution and new libraries.
In this case, older versions of libraries may be removed.
For example, libwebkit2gtk-4.0 no longer exists in Debian 13.
This means that the programme must be compiled with PB Linux3, which then uses libwebkit2gtk-4.1.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply