Difference between GNUWin32 and cygwin
Asked Answered
H

2

28

I can't seem to get a handle on the difference between the two.

It seems that one (GNUWin32) is an layer on top of windows (like MSYS) and the
other (cygwin) is something else (?)

What does that mean? When would I use one over the other? Are they both suited for the same thing?

I want to use it mainly for git but want to keep my options open for learning and doing all thing *nixy.

Is there another tool for this? Will msysgit be better suited for this?
Are there any resources that go through the differences of all of these *nix platforms exhaustively?

Hafner answered 23/5, 2012 at 2:3 Comment(1)
Does anyone know what GNUWin32's status is after Windows 7? I'm on Windows 10. I'd post a separate question but I bet it will be closed as not a programming question.Ladykiller
L
43

Cygwin is a library that endeavours to make UNIX programs able to compile and run on Windows systems with minimal or no modifications, and a comprehensive set of packaged UNIX tools and applications compiled with this library. It is almost a complete wrapper around Windows. It includes an X server and an awful lot of the programs that you can expect to find in a Linux distribution. It is great for people who want to learn or use the UNIX command line in Windows.

MSYS is mostly a port of the UNIX tools necessary to build GNU style packages (with a configure etc) on Windows systems with the MinGW compiler. It uses a variant of the Cygwin library modified to sacrifice some compatibility for efficiency, and is more Windows-friendly.

GnuWin32 is simply a port of some of the GNU tools to Windows. Like MSYS, it uses msvcrt.dll, as well as an additional library to provide some UNIX compatibility functions. Its main purpose appears to be to allow Windows programs and batch files to use some of the GNU programs and libraries directly.

For the most part, they all provide UNIX programs on Windows, but there are many subtle differences, including:

  • Intent. Cygwin is for people who want to use UNIX on their Windows OS. MSYS is for people who want to build Windows programs using the GNU/UNIX build tools. GnuWin32 is a port of individual GNU programs and libraries to Windows.
  • Text files, particularly line endings. Cygwin lets you use CR/LF or LF. MSYS expects LF line endings. GnuWin32 programs expect CR/LF line endings.
  • Supplied programs. In particular, Cygwin has a lot more packages, and GnuWin32 doesn't provide any shells.

As for git, it is available with Cygwin - this version can be used in a Windows directory (accessible under /cygdrive). Also, as mentioned, there is msysgit.

Lechner answered 23/5, 2012 at 3:16 Comment(7)
That's incorrect regarding MSYS. MSYS programs are based on the MSYS DLL, which is a fork of the Cygwin DLL, and are built using a special MSYS toolchain instead of the MinGW toolchain. However, the purpose of MSYS is to provide a Unix-like environment for building native Windows programs with the MinGW toolchain.Brame
Awesome answer! How does Gow factor in?Hafner
don't know, never used it. Feel free to mention it in an ansewr.Lechner
@Brame answer amended. Never got around to double-checking what library(s) MSYS uses, thanks for the info.Lechner
I love and use cygwin since years, but one also has to beware of certain pitfalls. An example: I had installed cygwin with everything under the earth installed, including its git. And cygwin was in my user path. Then I installed ruby (Windows installer), not from cygwin (even don't know if it's available there). But when ruby tried to do something with the git installation from cygwin, things broke at the path level. Rubys and cygwins path handling couldn't work together. Solution? Remove cygwin from user path, use msysgit installation and watch more carefully what's in my user search path.Daffie
@Daffie The sort of the same is now happening with ChocolateyTwitty
From brief inspection gow appears indestinguishable from malware. but that's probably just a noob problem.Timbal
O
1

Michael Slade is correct. I would like to talk about the typical usage environment.

For practical reasons I use gnuwin as a light backend for stuff only remotely related to POSIX environments while cygwin is more of a full blown POSIX and even a very gnunixish environment.

Also gnuwin tends to become bloated when installing lots of tools because the executables are often using statically linked libraries. Cygwin on the other hand delivers a ton of dynamical libraries and rather small executables. So if you only need a few executables then gnuwin needs less resources. If you need a complex environment then cygwin will be more efficient.

gnuwin is also often slightly outdated, offers few software, no package/update-manager. It is a basic shell environment. No ssh, no gcc, vim, no perl, no sql - you can get these from other sources but how these cooperate is hard to predict. Cygwin fixes all above problems.

In other words, gnuwin is great for the occasional installer, for just putting du, find and sort in your $PATH. To do some real POSIX work use cygwin.

I once had a second Linux workstation, then a Linux VM running next to my windows system. Cygwin made them obsolet. It is good enough for a ton of things while saving tons of resources in comparison to a dedicated computer or a VM.

Opiate answered 18/11, 2020 at 10:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.