Find the answer to your Linux question:
Results 1 to 2 of 2
HI every body, Iam new to linux , and i need a clarification. i had written a c program and complied (usng gcc) on linux machine . what ever the ...
  1. #1
    Linux Newbie
    Join Date
    Oct 2006
    Posts
    107

    doubt on c program executable

    HI every body,


    Iam new to linux , and i need a clarification.


    i had written a c program and complied (usng gcc) on linux machine .

    what ever the executable file is generated that have to be run on different platforms . Is it possible ?

    if any body knows . pls help me.

    Thanks in Advance

  2. #2
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    The executable will run on any system that is the same as yours. That is, if you are running an x86 architecture with 32-bit Linux, the executable will run on any x86 architecture with 32-bit Linux, assuming, of course, that the system has the necessary libraries.

    Now, what are you trying to do?

    If you want to run this executable on a different operating system (same architecture) if the system supports the ELF format, then all is well! ELF is the binary format that we use on Linux, and is also used on Solaris, the BSDs, etc. If you want the binary to run on Windows or Mac OS X, you have a bit of a different situation. The binary _may_ run on Mac OS X (since it's based on BSD), but I don't know for sure.

    As for Windows, they use a completely different format, so you will need to recompile for that.

    If you want to run the executable on a different architecture, you can do a process called cross-compiling to create an ELF binary that works on a different architecture. The Wikipedia article has some info:
    Cross compiler - Wikipedia, the free encyclopedia
    DISTRO=Arch
    Registered Linux User #388732

Posting Permissions

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