Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm getting some weird behaviour for a binary file I'm trying to run. I'm using Mac OSX snow leopard, and the binary itself is part of labkey software .. built from source.

If I try to run the file using an absolute path it won't work .. failing with an error like

-bash /Users/me/Sources/labkey/build/bin/program: cannot execute binary file

However if I change to the directory /Users/me/Sources/labkey/build/bin/program and run the binary just by typing its name it works fine.

I've explored a number of permutations on executing the file.

From within the directory /Users/me/Sources/labkey/external/osx/bin/program if I attempt to run using

./program

I get the error above, but if I use

program

I don't get an error.

Any ideas on what could be going wrong?

Thanks for the answers just adding more info; Output of file ./program is;

./Program: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.4, not stripped

Output of "which program" is;

Users/me/Sources/labkey/build/bin/program

share|improve this question
    
What do you get if you do a "which program"? –  John Gardeniers Feb 23 '10 at 4:55
    
file ./program –  Dave Cheney Feb 23 '10 at 4:58

1 Answer 1

up vote 2 down vote accepted

You could have another installation of the file you are trying to run. When you run it without the "./" it could be calling it from somewhere else on your system (as it's in your PATH).

Do a "which program" to see if you are indeed calling the right file.

share|improve this answer
    
Yep .. that's the answer. I've got another copy in my path .. one works .. one doesn't. thanks –  Ira Cooke Feb 23 '10 at 6:43

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.