Cygwin Wiki

Cygwin is an emulation layer that allows programs written for UNIX, GNU, or Linux systems (POSIX environment) to run on MS Windows platforms. Programs must be specifically compiled for Cygwin, but in most cases few changes to the source code are required to achieve successful compilation, and use. (Once again, GNU/Linux, BSD, and UNIX binary executables are NOT suitable for Cygwin.)

Cygwin was originally developed by Cygnus Solutions which has been a part of Red Hat since 2000. The goal of the project then, as now, was to allow Windows users to harness the myriad of free (libre) and open source (FLOSS) programs that are available in the *U*X environment. While many of these programs are aimed at software development, there are also many that have applicability beyond that technical domain. Still, Cygwin will have the greatest applicability to technically oriented users who are conversant with programming or scripting languages, and the *U*X environment.

Programs supported by Cygwin work well on MS Windows NT and the offshoots of that real multitasking OS, including Windows 2000, Windows XP, and Windows Vista, i.e., Windows 4.x through Windows 6.x. While some Cygwin application run acceptably on Windows 9x and Windows ME, these latter pseudo-OSes are no longer supported. Cygwin provides header files and libraries that make it possible to recompile or to port Unix applications for use on computers running Microsoft Windows OSes. However, it does not make binaries compatible with such computers running without Cygwin.

Cygwin is currently (circa 2024) managed by a wide variety of volunteers both within and outside of the IT industry. The project lead is Corinna Vinschen.

Cygwin is released under the GNU GPL, and consequently Cygwin is free software. Currently, Cygwin is not only free in the GPL/source code sense, but is also cost-free, and freely available as executable code from its web site. Red Hat, in turn, provides fee-based services for enterprises using the Cywin emulation layer and corresponding FLOSS applications built on top of it.

Description[]

Cygwin consists of a library that implements the POSIX system call API in terms of Win32 system calls, a GNU development tool chain (such as GCC and GDB) to allow basic software development tasks, and a large number of application programs equivalent to those on POSIX systems. Many Unix programs have been ported to Cygwin, including the X Window System, KDE, GNOME[1], Apache, and TeX. Cygwin permits installing inetd, syslogd, sshd, Apache, crond and other POSIX daemons as standard Windows services , allowing Microsoft Windows systems to work like UNIX and Linux servers.

All of these programs are installed by running Cygwin's "setup" program, which downloads the necessary files from the Internet. Cygwin's setup.exe can install, update, and remove programs and download the source code for them.

The beauty of Cygwin is that from a development perspective, it provides a minimal set of feature concepts that allow Windows systems to behave as POSIX systems. Efforts to reconcile concepts that differ between Unix and Windows systems include:

  • A Cygwin-specific version of the Unix mount command allows Windows paths to be mounted as filesystems in the Unix file space. Mount information is normally stored in the registry. Filesystems can be mounted as binary ones (by default), or as text-based ones, which enables automatic conversion between LF and CRLF endings. (This only affects programs that call open() or fopen() without specifying text or binary. Programs installed by Cygwin's setup.exe program always open files in binary mode when appropriate, thus avoiding the problem.) Disk drives (C:, D:, etc.) are also denominated /cygdrive/c, /cygdrive/d, etc. Windows network paths of the form \\HOST\SHARE\FILE are mapped to //HOST/SHARE/FILE.
  • Full-featured /dev and /proc file systems are provided. /proc/registry provides direct filesystem access to the Windows registry.
  • Symbolic links are provided, and use .LNK files (Windows shortcuts) containing Cygwin-specific information, and with the "system" attribute set to speed up processing.
  • The Solaris API for handling Access Control Lists (ACLs) is supported and maps to the Windows NT ACL system.
  • Special formats of /etc/passwd and /etc/group are provided that include pointers to the Windows equivalent SID's (in the GECOS field), allowing for mapping between Unix and Windows users and groups.
  • Various utilities are provided for converting between Windows and Unix file formats, for handling line ending (CRLF/LF) issues, for displaying the DLLs that an executable is linked with, etc.
  • The Cygwin library also interfaces to existing Windows libraries. It is possible to call Windows functions like waveOut from Cygwin executables themselves.
  • The ability to run POSIX daemons as native Windows services

The version of GCC that comes with Cygwin has various extensions for creating Windows DLLs, specifying whether a program is a windowing or console mode program, adding resources, etc. It also provides support for compiling MinGW-compatible executables (that is, executables that do not require Cygwin to be installed to run, or more specifically, executables that don't require Cygwin's CYGWIN1.DLL, which provides the POSIX compatibility layer).

Cygwin is used heavily for porting many popular pieces of software to the Windows platform. It is used to compile Mozilla Firefox, Sun Java, and OpenOffice.org.

Red Hat normally licenses the Cygwin library under the GNU General Public License with an exception to allow linking to any free software whose license conforms to the Free Software Definition. (Red Hat also sells commercial licenses to those who wish to redistribute programs that use the Cygwin library under proprietary terms.)

History[]

Prior to 1995, at least two commercial, proprietary POSIX environments were available for Windows. These early environments were the MKS Toolkit and the Thompson Toolkit. However, these toolkits suffered from a number of limitations, including:

  • They did not provide a C compiler to allow other applications to be developed solely within the provided environment. That is, you had to buy a commercial compiler from say Microsoft or Borland to even begin to do software developmnent with the toolkit.
  • Commercial compilers with the toolkits did not provide a sufficient environment for harnessing FOSS code available from and through FOSS sites such as SourceForge.net, and FreshMeat.net.

Cygwin began in 1995 as a project of Steve Chamberlain, a Cygnus Solutions engineer who observed that Windows NT and 95 used COFF as their object file format, and that GNU already included support for x86 and COFF, and the C library newlib. It seemed to him, therefore, that is should not be difficult to retarget GCC and get a cross compiler producing executables that would run on Windows. This proved to be so in practice, and a prototype came up quickly.

The next step was to attempt to bootstrap the compiler on a Windows system, but this required enough emulation of Unix to let the GNU configure shell script run, which requires a shell like bash, which in turn requires fork and standard I/O. Windows includes similar functionality, so the Cygwin library just needs to properly translate calls and manage private versions of data, such as file descriptors.

Initially Cygwin was called gnuwin32 (not to be confused with the current GnuWin32 project). The name was changed to Cygwin32 to emphasize Cygnus' role in creating it. When Microsoft registered the trademark Win32, the 32 was dropped to simply become Cygwin.

By 1996, other engineers had joined in, because it was clear that Cygwin would be a useful way to provide Cygnus' embedded tools hosted on Windows systems (the previous strategy had been to use DJGPP). It was especially attractive because it was possible to do a three-way cross-compile, for instance to use a hefty (in mass, $s, and relative computing power of the time) Sun workstation to build, say, a Windows-x-MIPS cross-compiler, which was faster than using the PC of the time. Starting around 1998, Cygnus also began offering the Cygwin package as a product of interest in its own right.

Derivatives[]

Cygnix is a limited X11 environment based on Cygwin. Its name is an abbreviation of "CYGnus pseudo-uNIX".

There are implementations of Cygnix in Windows 95/98/ME, Windows NT/2000, Windows XP and also AmigaOS 4.0.

Additions to Cygwin[]

Extensions to Cygwin are available, such as Cygwin/X, a port of the X Window System, and in turn, the Gnome and KDE Desktop as KDE on Cygwin resp. Cygwin Gnome.

Alternatives to Cygwin[]

Several open-source and proprietary alternatives are available for people who need simultaneous access to both MS Windows and UNIX environments on the same hardware.

Other UNIX emulators for Windows[]

Toolsets like Microsoft Windows Services for UNIX--now discontinued, MKS Toolkit, UnxUtils, GnuWin32 and UWIN aim to provide a complete POSIX like environment, as does Cygwin. They implement at least a shell, several utilities, including the familiar UNIX compiler tools, including make and the cc command line interface to the C programming environment. UnxUtils only provides a subset, as it restricts itself to use only the features provided by the Microsoft C Runtime environment.

Programming tools[]

MinGW on the contrary, only provides the set of GNU Programming tools, without the interactive environment, with which to port UNIX applications to Windows.

It is also possible to develop applications based on a cross-platform toolkit like Qt, PWLib, allowing those applications to be compiled on either platform and provide users with the same experience.

Reverse approach[]

A radically different approach is available with [[Wine (software)]], which is a re-implementation of the Windows API and toolset for Linux and similar systems, while virtualisation engines like VMware and Xen allow Windows and Linux or UNIX to run concurrently on top of a hypervisor microkernel.

Finally, Cooperative Linux was created to run just Windows and Linux simultaneously on the same hardware.

See also[]

References[]

External links[]

Template:Wikibooks