msys2 里的 mingw 和 msys 有什么区别?

日期: July 13, 2019 作者:网站维护


先了解 mingw,它的官网有很清楚地介绍 mingw 和 msys 是做什么的,把它粘贴到末尾了。

mingw 包括一些开源的语言编译器,msys 就是 GNU 下常用的 shell模拟终端、grep这类工具命令。mingw并不实现 POSIX 标准。POSIX是什么?这个是一种操作系统接口定义,Linux 操作系统就使用了这个接口。POSIX定义之初为了让开发者写的程序源码能在不同的操作系统里编译,比如其他的类nix的操作系统,一套源码各个系统都能编译使用了。但使用最多的windows并没有实现这套标准。POSIX 包括文件系统之类的定义,具体可以查看这个标准文档的目录。

mingw 只支持编译32位,后来又出现一个作者,做了一个 mingw-w64 把功能增强,支持了64位。

mingw 和 mingw-w64 是两个项目。


另外,msys2一样拥有msys的工具集(bash grep 之类的命令),更重要msys2自己还有一套编译器,还几乎实现了POSIX标准,更适合编译 POSIX 系统下的源码,但是编译的程序依赖msys2的运行库。mingw/mingw-w64 编译出程序没有这样的依赖。


MinGW, a contraction of "Minimalist GNU for Windows", is a minimalist development environment for native Microsoft Windows applications.

MinGW is a registered trademark of Software in the Public Interest Inc., registration number 86017856; it has been registered on behalf of MinGW.org, and its use by any other project is unauthorized.

MinGW provides a complete Open Source programming tool set which is suitable for the development of native MS-Windows applications, and which do not depend on any 3rd-party C-Runtime DLLs. (It does depend on a number of DLLs provided by Microsoft themselves, as components of the operating system; most notable among these is MSVCRT.DLL, the Microsoft C runtime library. Additionally, threaded applications must ship with a freely distributable thread support DLL, provided as part of MinGW itself).

MinGW compilers provide access to the functionality of the Microsoft C runtime and some language-specific runtimes. MinGW, being Minimalist, does not, and never will, attempt to provide a POSIX runtime environment for POSIX application deployment on MS-Windows. If you want POSIX application deployment on this platform, please consider Cygwin instead.

Primarily intended for use by developers working on the native MS-Windows platform, but also available for cross-hosted use, (see note below -- you may need to follow the "read more" link to see it), MinGW includes:

A port of the GNU Compiler Collection (GCC), including C, C++, ADA and Fortran compilers;
GNU Binutils for Windows (assembler, linker, archive manager)
A command-line installer, with optional GUI front-end, (mingw-get) for MinGW and MSYS deployment on MS-Windows
A GUI first-time setup tool (mingw-get-setup), to get you up and running with mingw-get.

MSYS, a contraction of "Minimal SYStem", is a Bourne Shell command line interpreter system. Offered as an alternative to Microsoft's cmd.exe, this provides a general purpose command line environment, which is particularly suited to use with MinGW, for porting of many Open Source applications to the MS-Windows platform; a light-weight fork of Cygwin-1.3, it includes a small selection of Unix tools, chosen to facilitate that objective.