Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

And once again, typical question: "cannot run executable file".

I Installed Virtual Box ver: 4.2.16 and on that Ubuntu.

I compiled several fotran codes with command (maybe it should be noted that I was at that moment ask to install gfortran, so I did.):

gfortran -o iri iritest.for irisub.for irifun.for iritec.for iridreg.for igrf.for cira.for iriflip.for

I got some warnings but no error. Then I wrote . iri and got:

 bash: . : iri: cannot execute binary file

As I read many A/Q about it on this page: here are the helpful information:

uname -a

Linux pavel-VirtualBox 3.5.0-43-genereic #66~precise1-Ubuntu SMP Thu Oct 24 14:55:08 UTC 2013 i686 i686 i 386 GNU/Linux

file iri

iri: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (used shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0xac4e2cda297fb7fc0dbea9bff7c88dfdb417c297, not stripped

file /bin/bash

/bin/bash: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (used shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x64552078250a29637d1678751065aa4b5ee35222, not stripped

I also tried chmod +x iri and got the same result. However I think that is was unnecessary as the output of ls -l before was:

-rwxrwxr-x 1 pavel pavel 1170853 Nov 10 13:30 iri

I also sent the file to windows and of course, it has no idea what to do with it. As the file and OS specifications are the same, I have no idea why the Ubuntu refuses to execute the file. Do you have an idea?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

To execute a binary file that is in the current directory (but not on your executable path) the correct syntax is

./iri

(note the /). The command you gave (with a space between the . and the filename) attempts to source the file as a script in the current shell - see help source

$ . hello
bash: .: hello: cannot execute binary file
$ 
$ ./hello
Hello world!
$ 
share|improve this answer
    
facepalm Sure, that was the point, I lost about 3 hours on that. Thank you. –  MasterPJ Nov 10 '13 at 15:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.