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
filename is um.exe and result is bash: ./um cannot execute binary file
That does not looks like a native Linux program. Try using wine.
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.
the output is :um: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
As you can see from the output of
file um
that 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.
So there is no solution to this?
@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.
Try making the file executable
chmod +x um.exe
Then try running it
./um.exe
But if this is a exe file compiled for Windows, you probably need to install Wine.
Another solution for people who are having this problem except the part about unmatched bits is that running the file without the command "bash".
Just use
chmod +x 'path to the file'
and then run'the path to the file'
in terminal.This is how I solved my problem.For Googlers:
- 32-bit or 64-bit? Check with
file yourbinary
- Permission to execute? Do
chmod +x yourbinary
- Path correct? Do
./yourbinary
- 32-bit or 64-bit? Check with
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
true
binary 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
mv
ed 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.
License under CC-BY-SA with attribution
Content dated before 6/26/2020 9:53 AM
January 8 years ago
Please type `file filename` and report results.