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
Solution 1:
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.
Solution 2:
For Googlers:
- 32-bit or 64-bit? Check with
file yourbinary
- Permission to execute? Do
chmod +x yourbinary
- Path correct? Do
./yourbinary
Solution 3:
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.