Results 1 to 2 of 2
Hi...
I would like to create a program that can be easily ported between several Linuxes... Therefore I would like to avoid compilation and have the ability to run it ...
- 10-27-2007 #1Just Joined!
- Join Date
- Oct 2007
- Posts
- 5
Using System calls without compilation
Hi...
I would like to create a program that can be easily ported between several Linuxes... Therefore I would like to avoid compilation and have the ability to run it as shell scripts runs...
My program need to call some system calls such as fork etc...
do you know a way to use them without compilation ?
thanks,
- 10-27-2007 #2
The powers that be are very careful about not changing system call numbers. You ought to be able to run compiled programs on just about any Linux around. The Adobe Acrobat binary I downloaded was not compiled with any kernel or any distribution in mind.
The most likely difficult case would be if you use system calls introduced in a later Linux and try to run the program in an earlier Linux. Such newer system calls are few and far between. Old standby system calls such as fork() should be as good as gold.
This is why it is possible for people to distribute LInux software as binaries. If they distribute different binaries for different Linux distributions, it is likely because they need to access certain files which might be at one place in one distribution and another place in another. (This is an issue you might wish to think about also.)
You'll increase your chances of success if you link static rather than dynamic.
You'll also increase your chances of success if you look in your code for anything that's likely to be a later system call. If it is, ship your code with an additional precompiled program which does nothing but execute a valid instance of this system call. You main program should attempt to run this other program, using fork() and something from the exec() family. This way you can come back with an intelligible error message such as "this binary won't run on this machine" or something.
Hope this helps.


Reply With Quote