0

I am a newbie when it comes to using machine code files!!!

I need to use a machine code executable obtained as ELF (Linux) into an exe file for Windows. I have tried 'objconv' but, though the format suggests to use '-fPE ', when I use that I get the command line indicates 'Error 2004 unknown command line' and 'Error 2103 cannot read input file'. I suspect that there is some incompatibility between Linus and Windows platforms

  • this won't work. Which tool do you try to convert? Look if there is already a Windows build. – magicandre1981 Apr 20 '15 at 4:22
  • 1
    This sounds like an XY problem. You need to explain what you're trying to do, not how you're trying to do it. (You start by saying "I need to use ..." but don't explain why you need to do that. This makes it impossible to answer your question.) – David Schwartz Apr 20 '15 at 5:21
  • 1
    What you're asking to do is impossible. However, you can get the ELF to run on Windows using Cygwin or a related tool, and you can get EXEs to run on Linux using WINE. And of course you could run everything in VMs. – Parthian Shot Apr 20 '15 at 7:13
1

Although the underlying object code may be the same between the platforms, non-trivial native applications can't be binary-compatible between Windows and Linux.

If Linux executable you are trying to convert is dynamically linked, it would require the presence of libraries that don't exist on Windows (you can see this list of libraries by running ldd /path/to/program on the Linux machine).

Even if you converted all the libraries to PE executable format or statically linked them, the system calls to the NT Kernel and Linux kernel are completely different. There is no direct one-to-one correspondence between them.

You best option would be to find the source code for the original application if possible. If the program is written in a portable way, it may compile on both Windows and Linux. Even though the system calls are not the same between the two platforms, a subset of their C library implementations have standardized behaviour.

0

This is almost certainly not going to work. Linux and Windows do not play nice with one another. The application you are looking to "convert" will have to be rebuilt from source for Windows (which will require Windows specific patching). With any luck the application you are trying to run already has a Windows port.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.