Figure out the minimum os version neede to run executable or link library.

Hello,
I need to figure out the minimum OS version needed to run some executable.
For the following OS: Linux, AIX, Solaris. For example how do I know the minimum OS version for /bin/ls ? "file" command does not give me much information. There are some tools that are helpful for understanding is the code 32 bit, or 64 bit, but they do not return the minimum OS requirements.

Thank you in advance.

This is a really odd question -- /bin/ls should work with the distribution it came with.
Pretty much anything in /usr, /sbin/, and /opt will work that way.

ldd /bin/ls

is about the best you can get. For solaris read isainfo man page, Linux try /etc/release, AIX I dunno. Solaris is very good about running older versions of code. However in all OS cases the limiting factor is almost always the current runtime libraries.

What EXACTLY are you trying to do ?? If it isn't simple curiosity, then you are asking for some trouble down the road.

what version of the kernel, you mean?

That's often not too relevant. The same kernel can run lots of different software. What's more important are the libraries it uses.

$ ldd /bin/ls
        linux-gate.so.1 =>  (0xb77bf000)
        librt.so.1 => /lib/librt.so.1 (0xb77ab000)
        libacl.so.1 => /lib/libacl.so.1 (0xb77a3000)
        libc.so.6 => /lib/libc.so.6 (0xb765a000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xb7641000)
        /lib/ld-linux.so.2 (0xb77c0000)
        libattr.so.1 => /lib/libattr.so.1 (0xb763a000)
$

Hello and tank you for the fast replay,

Here is some additional information on what I'm trying to do.
I'm trying to achieve the following goal: Automatically name the zip file containing binaries, and libraries compiled on the machines having the above OSes.
The name of the zip file containing the program named prog and it's libraies must be like in the example bellow:
prog-AIX_5.3-RISC.zip
prog-SunOS_5.10-x86_64.zip
prog-SunOS_5.8-SPARC.zip
prog-Linux_2.6.38-x86_64.zip
and so on ...
This is to avoid executing AIX 5.3 executable on AIX 5.2 for example. There are some cases in which the executables are not backward compatible.
I'm trying to avoid this.

For Linux "file" command returns the minimum Linux Kernel that was used during the compilation process.

For the other OSes I can get some information. What I'm not able to do directly is to predict what is the minimum OS version (or kernel version) needed to execute the code. For AIX there is dump command , but it is not much of a help. ldd does not help either. I was wondering how the OS itself decides is this good program (instruction set) to execute.

Hope the question is more clear now.

Why would you use a zip file to hold UNIX executable files? Permissions may not be preserved properly, which could play havoc. Tarballs are better suited.

This really isn't relevant. You can often run x86 binaries from 1992 on a modern Linux system if you have old enough libraries, or the new libraries are compatible. The way many basic system calls work hasn't changed much since Linux's inception. The libraries are what's really important.

Use packages that were actually distributed for these various operating systems instead of keeping your own tarballs of randomly packaged binaries, and you'll have programs that're supposed to work and know exactly what their dependencies are.