1
  1. Does Cygwin only run Windows executables? When I run a ELF program inside Cygwin running in Windows 10, it says that

    $ ./wkhtmltopdf
    -bash: ./wkhtmltopdf: cannot execute binary file: Exec format error
    
    $ file wkhtmltopdf
    wkhtmltopdf: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter
    /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.18,
    BuildID[sha1]=b6566a9e44c43a0eebf18d8c1dc6cb616801a77e, stripped
    
  2. Does Cygwin provide implementations of those common linux utilities as Windows executables with the same basename but adding .exe as extension name?

  3. Can Cygwin run any native Windows executables, or most of them?

Thanks.

6

From https://www.cygwin.com/

Cygwin is:

  • a large collection of GNU and Open Source tools which provide functionality similar to a Linux distribution on Windows.

  • a DLL (cygwin1.dll) which provides substantial POSIX API functionality.

Cygwin is not:

  • a way to run native Linux apps on Windows. You must rebuild your application from source if you want it to run on Windows.
  • a way to magically make native Windows apps aware of UNIX® functionality like signals, ptys, etc. Again, you need to build your
    apps from source if you want to take advantage of Cygwin
    functionality.

So about your questions:

  1. you can not run ELF on Windows. You need a Virtual Machine with Linux for that
  2. cygwin provide Unix utilities, but some could have the same name of Windows one. Exe extension is maintained for compatibility.
  3. yes. Cygwin programs are also Windows one
  4. yes. Cygwin programs can start normal windows (not-cygwin) programs.
|improve this answer|||||
1

cygwin runs programs that run from cmd.exe So cmd.exe programs can be run from cygwin.exe and cygwin.exe programs can be run from cmd.exe

Even to the point where you can even take a cygwin utility that you'd almost never run normally from plain cmd.exe and you can run it

C:\cygwin\bin>chmod --help
Usage: chmod [OPTION]... MODE[,MODE]... FILE...
  or:  chmod [OPTION]... OCTAL-MODE FILE...

You can even launch notepad from cygwin

user@comp ~
$ notepad.exe a.a


user@comp ~
$ xcopy /?
Copies files and directory trees.

XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]

You can try dir , though it runs cygwin's implementation of dir which is like ls.

user@comp ~
$ where dir
C:\cygwin\bin\dir.exe

user@samsung350 ~
$ dir
a         adfff           dfds      gg2.exe             r.php

One could ask then what are the differences between cygwin implementations and cmd.exe implementations. Two differences i've run into - Generally cygwin implementations of utilities would favour LF as opposed to CRLF. And in some cases may be designed more to be used with single quotes as opposed to double quotes.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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