Introducing MinGW and Cygwin

D

DevynCJohnson

Guest
With Linux becoming popular and Unix and POSIX being well formed standards, many people may need or want to use such utilities and protocols on Windows. Thankfully, there is a way to run Linux tools on Windows and run applications in Windows that were compiled on Linux.

Cygwin
First, there is Cygwin (https://www.cygwin.com/) which provides a Unix-like environment for Windows. Cygwin provides a Unix-like command-line and the POSIX API. Thanks to Cygwin, many Linux and Unixoid applications can be ported to Windows and run natively. For instance, KDE3, Apache, GNOME, etc. have been ported to Windows via Cygwin. Cygwin also allows Windows to run daemons like the usual Windows services.

Unixoid applications running in Cygwin execute and behave like normal/native Windows applications. They can also access Windows libraries and the Windows API. However, users must have the source code and compile it on the Windows system. In other words, users cannot install Linux applications from Debian or RPM packages.

Cygwin allows many interfaces to be usable and compatible. The POSIX system calls are available through WIN32 syscalls. Also, the Solaris API for access control lists (ACLs) converts easily to the Windows NT ACL system. UTF-8 (used by Linux) and UTF-16 (used by Windows) are transparently converted to each other. The /etc/passwd and /etc/group systems are mapped (via the GECOS field) to be equivalent to the SIDs used by Windows.

Window's drive-letter scheme is mapped to a Unix-style path. Drive C is "/cygdrive/c". /dev/ and /proc/ are also supported. In fact, /proc/registry/ offers a filesystem-interface to Windows' registry.

The various mappings and compatibility layers are not 100% Unix or POSIX compliant. For instance, the mount command on Cygwin is a modified Unix mount command made specifically for Cygwin. Also, the fork syscall is not entirely complete. Symbolic links (soft links) are not POSIX-compliant.

The Cygwin command-line is BASH and the included terminals are Xterm, Mintty, and rxvt-unicode.

Cygwin supports 32 and 64-bit Windows systems.

Cygwin/X is an X11 display server for Cygwin and is a port of Xorg (http://x.cygwin.com/).

MingGW
Minimalistic GNU for Windows (MinGW - http://www.mingw.org/) provides a way to use the GNU developer tools (such as GCC) on Windows. In other words, MinGW is a GNU Compiler Collection (GCC) port to Windows. Programs compiled using MinGW can be run on Windows. Also, the MinGW cross-compilers allow developers to compile programs for Windows from a Linux system.

The MinGW compilers supports C/C++, Objective-C/C++, Ada, and Fortran.

Not all Unixoid applications compiled using MinGW will work on Windows. When using Linux to develop software and cross-compile, remember that some applications may not compile or port successfully. Some developers may need to change some of their code. For instance, try to use cross-platform or ported libraries such as SDL, GTK, Qt, etc.

Mingw-w64 (http://mingw-w64.yaxm.org) is a fork that provides newer features such as gcc-5.x support (while MinGW supports gcc-3.4.5).

“mingwPORTs” are user-made additions to the MinGW software collection.

Xming is an Xorg port for Windows to provide the X11 protocol and display server (http://www.straightrunning.com/XmingNotes/).

MSYS
Minimal System (MSYS - http://www.mingw.org/wiki/msys) is a MinGW-related package that consists of GNU utilities. Such utilities include Bash, make, grep, and others. It is strongly recommended that MSYS and MinGW both be installed together. MSYS does not have all of the features that Cygwin can offer.

Other
Other Cygwin-like projects exist, although they may be deprecated, unmaintained, beta-stage, old, etc. such as UnxUtils, DJGPP (DJ's GNU Programming Platform), and GnuWin32. UWIN may be usable (http://www2.research.att.com/~astopen/download/uwin/uwin.html).

MKS Toolkit appears to be an active project (http://www.mkssoftware.com/).

Conclusion
Cygwin is to Windows as WINE is to Linux. MinGW is a developer's suite. Applications compiled for Cygwin only work on Windows systems with Cygwin, and applications compiled using MinGW work on Windows (with or without MinGW). Like WINE, Cygwin is not an emulator. Rather, it is a compatibility layer. Also, MinGW and Cygwin cannot provide a way to run Windows applications on Linux.

Further Reading
 

Attachments

Last edited:


R

rstanley

Guest
MinGW is a developer's suite. Applications compiled for Cygwin only work in Cygwin and applications compiled using MinGW work on Windows. Like WINE, Cygwin is not an emulator.
I disagree. I don't develop GUI applications, and normally run only Linux, but but I do have cygwin running on an old Windows XP computer, for test purposes, and as long as C:\cygwin\bin is in the PATH for the users environment, you CAN run cygwin compiled CLI apps in a "cmd" window, or from the "Start" "Run" field.

Plus most if not all the Linux commands you can run in a cygwin terminal you can run in a Windows, "cmd" window as well, such as 'ls', 'man', 'grep' and others.

I would also consider cygwin also a developers environment, although neither MnGW or Cygwin are as useful as a full blown Linux Distro installation!

Edit:
Many development packages, utilities, libraries, editors, apps, etc... are available, through running the Cygwin Setup app, besides the standard gcc compiler and other utilities, including the full MinGW packages for win32, and win64 development. I feel the Cygwin system is a more complete environment for Windows. The Setup app can be run multiple times to install, reinstall, and remove packages as needed.
 
Last edited:
D

DevynCJohnson

Guest
I disagree. I don't develop GUI applications, and normally run only Linux, but but I do have cygwin running on an old Windows XP computer, for test purposes, and as long as C:\cygwin\bin is in the PATH for the users environment, you CAN run cygwin compiled CLI apps in a "cmd" window, or from the "Start" "Run" field.
Let me clarify. By saying "Applications compiled for Cygwin only work in Cygwin and applications compiled using MinGW work on Windows", I do not mean that the program must run in a Cygwin terminal. However, the system must have Cygwin. Cygwin is a compatibility layer for Windows just as WINE is a compatibility layer for Linux. Even when a Cygwin program is running in a regular Windows shell, Cygwin is still being used, just like when a Linux user clicks a Windows executable in Nautilus (WINE is still used).

This edit to the article may clear up misunderstandings.
Old
Applications compiled for Cygwin only work in Cygwin and applications compiled using MinGW work on Windows.
Modified
Applications compiled for Cygwin only work on Windows systems with Cygwin, and applications compiled using MinGW work on Windows (with or without MinGW).
 


Members online


Latest posts

Top