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 6 7 Answers
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.
3For Googlers:
- 32-bit or 64-bit? Check with
file yourbinary - Permission to execute? Do
chmod +x yourbinary - Path correct? Do
./yourbinary
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.
Try making the file executable
chmod +x um.exeThen try running it
./um.exeBut if this is a exe file compiled for Windows, you probably need to install Wine.
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 errorIf 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 fileI 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.
More in general
"Zoraya ter Beek, age 29, just died by assisted suicide in the Netherlands. She was physically healthy, but psychologically depressed. It's an abomination that an entire society would actively facilitate, even encourage, someone ending their own life because they had no hope. Th…"