Bash: ./filename : Cannot execute binary file
I couldn't execute a fortran compiled code in ubuntu 11.10 32 bit.
Error message is
bash: ./filename : Cannot execute binary file.
I've installed the gcc and gfortran libraries too.
Could anyone help?
$ file um um: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
this executable is compiled using a make file which compiles a set of fortran codes. this exe is made in fedora machine
Please type `file um.exe` or `file um` (whichever is the name of your binary file). However, likely the generated binaries are for one reason or other Windows binaries. Also, if the program is public, you can post the link to the sources. Or just post the makefile here.
As you can see from the output of
file umthat you posted in a comment, your binary is a 64-bit binary.
32 bit systems cannot run 64 bit binaries, it only works the other way around.
This is the most common reason I've seen for this problem, using `file` will identify this quite quickly.
@JohnMerlino Either provide Hardware with the correct instruction set and a OS which enable it (AMD64 Hardware and OS for AMD64 Programs). or simulate/emulate/virtualize it (Virtual Box/JVM/...) or get a version for your instruction set. You can not run Software for other Instruction set as native Programs.
Another possible source of this error: trying to run a Linux binary executable on a Mac, or vice versa.
For instance, trying to run the
truebinary from my Mac on an Ubuntu box that I SCPed it to:
$ ./mactrue -bash: ./mactrue: cannot execute binary file: Exec format error
If you've downloaded a binary and executing it fails with this error, check if you've downloaded the version for the wrong OS.
For me, copying the binary into Applications on my Mac then into my Path messed it up on my Mac. I'm pretty sure the Applications folder turned the binary into an Alias instead of an actual binary.
-bash: /usr/local/bin/terraform: cannot execute binary file mike$ file /usr/local/bin/terraform /usr/local/bin/terraform: MacOS Alias file
I unzipped the binary from my Downloads again and just
mved it to my Path and it worked fine.
mike$ file /usr/local/bin/terraform /usr/local/bin/terraform: Mach-O 64-bit executable x86_64
For me, I was working in a Vagrant (VirtualBox) VM but had unplugged the portable hard-drive on which the VM image was stored -- I plugged in the harddrive and rebooted the VM and my binary was executable again.
I guess a large part of the VM was loaded into memory as I could still use it and execute system binaries.