Skip to content

Instantly share code, notes, and snippets.

@ReneNyffenegger
Created March 16, 2019 11:14
Show Gist options
  • Save ReneNyffenegger/a8e9aa59166760c5550f993857ee437d to your computer and use it in GitHub Desktop.
Save ReneNyffenegger/a8e9aa59166760c5550f993857ee437d to your computer and use it in GitHub Desktop.
msys2 vs msys vs msysgit
MinGW doesn't provide a linux-like environment, that is MSYS(2) and/or Cygwin
Cygwin is an attempt to create a complete UNIX/POSIX environment on Windows.
MinGW is a C/C++ compiler suite which allows you to create Windows executables - you only
need the normal MSVC runtimes, which are part of any normal Microsoft Windows installation.
MinGW provides headers and libraries so that GCC (a compiler suite,
not just a "unix/linux compiler") can be built and used against the Windows C runtime.
MSYS is a fork of Cygwin (msys.dll is a fork of cygwin.dll)
cygwyn gcc + cygwin environment defaults to producing
binaries linked to the (GPL) cygwin dll (or cygwin1.dll???)
mingw + msys defaults to producing binaries linked to the platform C lib.
MinGW: It does not have a Unix emulation layer like Cygwin, but as a
result your application needs to specifically be programmed to be able to run in Windows,
MinGW forked from version 1.3.3 of Cygwin
Unlike Cygwin, MinGW does not require a compatibility layer DLL and thus programs do not need to be distributed with source code.
This means, other than Cygwin, MinGW does not attempt to offer a complete POSIX layer on top of Windows,
but on the other hand it does not require you to link with a special compatibility library.
Cygwin comes with the MingW libaries and headers and you can compile without linking to the cygwin1.dll by
using -mno-cygwin flag with gcc. I greatly prefer this to using plain MingW and MSYS.
( This does not work any more with cygwin 1.7.6. gcc: The -mno-cygwin flag has been removed; use a mingw-targeted cross-compiler. )
MSYS is a collection of GNU utilities such as bash, make, gawk and grep to allow building of applications and programs
which depend on traditionally UNIX tools to be present.
It is intended to supplement MinGW and the deficiencies of the cmd shell.
An example would be building a library that uses the autotools build system. Users will typically run "./configure" then "make" to build it.
The configure shell script requires a shell script interpreter which is not present on Windows systems, but provided by MSYS.
A common misunderstanding is MSYS is "UNIX on Windows", MSYS by itself
does not contain a compiler or a C library, therefore does not give the
ability to magically port UNIX programs over to Windows nor does it provide any UNIX specific functionality
like case-sensitive filenames. Users looking for such functionality
should look to Cygwin or Microsoft's Interix instead.
MSYS2 uses Pacman (of Arch Linux) to manage its packages and comes with three different package repositories:
- msys2: Containing MSYS2-dependent software
- mingw64: Containing 64-bit native Windows software (compiled with mingw-w64 x86_64 toolchain)
- mingw32: Containing 32-bit native Windows software (compiled with mingw-w64 i686 toolchain)
Cygwin provides a runtime library called cygwin1.dll that provides the POSIX compatibility layer
where necessary. The MSYS2 variant of this library
is called msys-2.0.dll and includes the following changes to support using native Windows programs:
1) Automatic path mangling of command line arguments and environment variables to Windows form on the fly.
MSYS is a fork of an old Cygwin version with a number of tweaks
aimed at improved Windows integration, whereby the automatic POSIX path
translation when invoking native Windows programs is arguably the most significant.
@adamleerich
Copy link

Thanks for making these notes public!

@TahsinTariq
Copy link

Really appreciate this!!!!

@Midi-In
Copy link

Midi-In commented Nov 23, 2020

Thank you as well

@GitBubble
Copy link

Thanks for making these notes public!

@etanim
Copy link

etanim commented Apr 11, 2021

on line 21 ("MinGW forked from version 1.3.3 of Cygwin") it almost seems that you mean msys instead of mingw. can you clarify? i have also heard some discussion and confusion about mingw packages vs msys packages on msys2. it seems mingw packages "run faster" but are less posix/unix compliant than msys2 packages. others have said mingw-in practice-runs no different than msys2 and is preferable and works the same in the msys2 environment. this all seems important to understand in light of the confusion of whether or not people should start using wsl more than msys2. it seems msys2 is still better than wsl options since it has a more native windows experience and offers direct unixlike usage in windows. any thoughts?

@qianyueyou
Copy link

And what's msysgit?

@Reilithion
Copy link

Thank you, this was extremely helpful and informative!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment