Find the answer to your Linux question:
Results 1 to 6 of 6
Can anyone explain to me what they are referring to when they say that binaries (executables) are machine dependent? Does this refer to the actual architecture of the machine that ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Engineer
    Join Date
    Nov 2002
    Location
    Queens, NY
    Posts
    1,319

    Compiled Binary


    Can anyone explain to me what they are referring to when they say that binaries (executables) are machine dependent? Does this refer to the actual architecture of the machine that the binary lies in?
    The best things in life are free.

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Binaries are dependent on a great many things. For one, naturally enough they can only be run on the CPU that they were compiled for. That's probably what "they" refer to as machine dependent.
    However, they are also ABI (application binary interface) dependent. They can usually only be run on the kernel that were compiled for (because of syscall compliance and so on).
    They are also binary dependent. They need the dynamic objects that they link against to be binary compatible on all systems that they might run on. If a symbol can't be matched (because of garbling conventions or anything), then it can't be linked. That's usually not a very large problem, though, since the core libraries tend to be binary compatible on almost all systems.

    All these can be remedied by recompiling and relinking the program from source, of course.

  3. #3
    Linux Engineer
    Join Date
    Nov 2002
    Location
    Queens, NY
    Posts
    1,319
    Would it be safe to say that my friend's machine has the exact same cpu and kernel if I can compile a program in my local Linux machine and run it on his FreeBSD machine?
    The best things in life are free.

  4. #4
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    FreeBSD has Linux binary emulation support, that's why it works. I believe Linux can emulate many other kernels as well, but that hasn't made it into the official kernel. The emulation framework is there, but all of the actual implementations for syscall emulation are in externally available patches. You can see what binary formats your Linux kernel supports by checking /proc/execdomains.

  5. #5
    Linux Engineer
    Join Date
    Nov 2002
    Location
    Queens, NY
    Posts
    1,319
    If I compile a program in Linux and try to run it on my Windows 2000 machine, I'm guessing that it will not run. Even though the CPU is the same, the kernel is different in both OS's and hence, it will not run?
    The best things in life are free.

  6. #6
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    No, that will certainly not work. Windows and Linux aren't even using the same binary file format. Linux, and basically all other UNIX systems, use ELF, while Winbloze (like always running blind past all kinds of standards) uses its own proprietary PE format, so it won't even recognize Linux binaries as executable programs.
    On top of that, Windows uses a completely different dynamic linking scheme than UNIX does.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •