我可以在 Cygwin 中运行哪些类型的程序?

Tim*_*Tim 2 windows cygwin

  1. Cygwin 是否只运行 Windows 可执行文件?当我在 Windows 10 中运行的 Cygwin 中运行 ELF 程序时,它说

    $ ./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
    
    Run Code Online (Sandbox Code Playgroud)
  2. Cygwin 是否将那些常见的 linux 实用程序的实现提供为具有相同基名但添加.exe为扩展名的Windows 可执行文件?

  3. Cygwin 可以运行任何原生的 Windows 可执行文件,或者大多数吗?

谢谢。

mat*_*eri 7

来自https://www.cygwin.com/

Cygwin 是:

  • 大量 GNU 和开源工具,提供类似于 Windows 上的 Linux 发行版的功能。

  • 提供大量 POSIX API 功能的 DLL (cygwin1.dll)。

Cygwin 不是:

  • 一种在 Windows 上运行本机 Linux 应用程序的方法。如果您希望它在 Windows 上运行,您必须从源代码重建您的应用程序。
  • 一种神奇地使本机 Windows 应用程序了解 UNIX® 功能(如信号、ptys 等)的方法。同样,
    如果您想利用 Cygwin
    功能,则需要从源代码构建应用程序。

所以关于你的问题:

  1. 你不能在 Windows 上运行 ELF。你需要一个带有 Linux 的虚拟机
  2. cygwin 提供 Unix 实用程序,但有些可能与 Windows 具有相同的名称。维护 exe 扩展名是为了兼容性。
  3. 是的。Cygwin 程序也是 Windows 之一
  4. 是的。Cygwin 程序可以启动普通的 windows(非 cygwin)程序。