This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bash: Cannot execute binary file

On 8/27/2011 7:50 AM, srinu wrote:
Buchbinder, Barry (NIH/NIAID) [E]<BBuchbinder<at>> writes:

Eliot Moss sent the following at Monday, March 28, 2011 10:28 PM
Why not just use the Windows version and invoke it from cygwin (if
cygwin is the environment from which you want to do that)? It is easy
to invoke Windows programs from cygwin; you just need to remember to
format any arguments in the form the Windows program wants. To that end,
cygpath is a useful utility, e.g.:

function acrobat () { }
   command acrobat $(cygpath -wa ${1})

in your .bashrc file allows you to invoke Windows acrobat with a path
rewritten from cygwin format to Windows format. This can be improved to
check for presence of the argument ${1}, etc., but perhaps you get the

- You should probably also add some quotes, in case your paths have spaces. - A complete path to acrobat will avoid needing to have it in your path. - Using cygstart will get you back to your command prompt.

function acrobat () {
     if [ -f "${1}" ]
         cygstart '/path/acrobat' "$(cygpath -wa "${1}")"
         echo "error: file `${1}' not found!"

Note:  I have not tested the above.  Debugging is left as an exercise for
the user.

- You also might look at, found here:
   Note:  I don't use it so YMMV.

Good luck.

- Barry
   Disclaimer: Statements made herein are not made on behalf of NIAID.


This problem is very frequently occuring irrespective of executable.
A new laptop, windows7, downloaded the Cygwin with utmostcare in slecetingthe
desired and permissions.
Wrote simple programe in c ( simple such that: print "hello world").
while try to run the executable created throws the error: cannot execute
binary file.

flow is like follows:
C file created: Hello.c ( full permissions)
Compiled and linked: gcc -c Hello.c -o helloTest
chmod 777 helloTest
bash: ./helloTest : cannot execute binary file

Tried all options which I know, googled no clue.
I tried in other machines too, same error.

I think something is missing, earlier used to work on my old system. But last
few months I tried several times reinstalling, new machines which I got for
personal use.

Is there any solution or inputs please.


start from here:

Problem reports:

further questions:
- local disk or network disk ?
- results of "ls -l helloTest" ?

-- Problem reports: FAQ: Documentation: Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]