Tag Archives: Exec format error

Solve cannot execute binary file: exec format error under Linux

For Linux, cannot execute Binary file: Exec Format error clearly indicates that it is an execution file format error.
1. Use the wrong command, such as GCC-c hello. c-o hello, and you get a.o file instead of an executable./hello will report the above error! Change to GCC hello. C-o Hello is ok!
2. If not the above error, it may be a version problem, such as the original 32 bit operating system, but the use of 64-bit software, at this time the need is to use the correct version of the software!

attached:
A solution to the problem that Cannot execute Binary File is encountered in Linux system,
From http://1381479.blog.51cto.com/1371479/888198

The problem that cannot execute Binary file is encountered in Linux system is generally caused by the following situations:

    1. 1.non-root user or non-execute permission
      1. 2.compilation environment is different (the program is copied from ot

    her operating environment)

For the first case, chmod + X program can be chmod +x program by adding execution permissions
In the second case, it is recommended to copy over the binary package of the program and recompile the program. In the actual operation process, I found that when I packaged the entire operating system environment of VPS in the United States and downloaded it to the local server, after unzipping it, the program running it would appear as shown in the question. I was puzzled. The system was all CENTOS5.2, and finally I found that it was caused by the difference between the two compilation environments:
1.The US VPS is the AMD64-bit processor

2.the local server is the Intel 32-bit processor

The hardware compilation environment of the two is different, which causes this problem. Of course, some programs downloaded from the non-binary package, can be executed directly, but the problem is also because the kernel does not match the CPU, Intel is x86, AMD is AMD64 or 32-bit version, corresponding to clear download. I hope this article will be helpful to you.