The essence of Linux binaries and libraries
Posted: Wed 10 Aug 2011, 14:06
Hi all,
Firstly I apologize if I've posted in the wrong place.
I have been "playing" with Linux (more specifically Puppy) for about a month
now and been "poking" here and there.
However now is the time to really get stuck in and do some programming.
(The compiled type into elf binaries as opposed to scripts).
Coming from the M$ world, things a very different with Linux and I need to
get clarification on a few things:
1) If I write a simple C program (and not use any extra libs) and compile it,
will it run on any Linux distro provided it's using the same kernel and runs
on a x86 platform?
(assuming my program only has console output, i.e. no GUI for now).
2) Another scenario, I write a program in C and call an external lib,
will the compiled program still run on any distro provided I supply the
some_lib.so ?
I understand that in this case Linux may not find the required lib if I don't
supply an install script to tell it where to put the program and where to put
the lib, hence the need for .pet files in the case of puppy, is this also correct?
3) Yet another scenario, I write a C program but have the required lib as a
.h source file which will be included at compile time, I assume in this case
there would be no need to include a compiled (.so) file of the .h ?
4) Is it also correct to assume that a separate script (for example using
gtkdialog) could then be used a a "wrapper" between the console output
of my program and a GUI? although in this case there could be
compatibility issues with gtkdialog ?
5) Are libs (.so) compatible with any distro, again assuming same kernel and platform ?
So in other words if I need a certain .so can I copy it from another distro
and put it on my puppy machine?
(the usual "gotchas" with GUI stuff and where to put it still applies).
Any help/pointers will be greatly appreciated.
Dave.
Firstly I apologize if I've posted in the wrong place.
I have been "playing" with Linux (more specifically Puppy) for about a month
now and been "poking" here and there.
However now is the time to really get stuck in and do some programming.
(The compiled type into elf binaries as opposed to scripts).
Coming from the M$ world, things a very different with Linux and I need to
get clarification on a few things:
1) If I write a simple C program (and not use any extra libs) and compile it,
will it run on any Linux distro provided it's using the same kernel and runs
on a x86 platform?
(assuming my program only has console output, i.e. no GUI for now).
2) Another scenario, I write a program in C and call an external lib,
will the compiled program still run on any distro provided I supply the
some_lib.so ?
I understand that in this case Linux may not find the required lib if I don't
supply an install script to tell it where to put the program and where to put
the lib, hence the need for .pet files in the case of puppy, is this also correct?
3) Yet another scenario, I write a C program but have the required lib as a
.h source file which will be included at compile time, I assume in this case
there would be no need to include a compiled (.so) file of the .h ?
4) Is it also correct to assume that a separate script (for example using
gtkdialog) could then be used a a "wrapper" between the console output
of my program and a GUI? although in this case there could be
compatibility issues with gtkdialog ?
5) Are libs (.so) compatible with any distro, again assuming same kernel and platform ?
So in other words if I need a certain .so can I copy it from another distro
and put it on my puppy machine?
(the usual "gotchas" with GUI stuff and where to put it still applies).
Any help/pointers will be greatly appreciated.
Dave.