What is cygwin and what does it do [closed]
Asked Answered
T

2

23

after searching about it i found some info (yet confusing for me)

Cygwin is a Unix-like environment and command-line interface for Microsoft Windows.

i found the above line in wikipedia but what does that mean? i'm not getting a clear idea about MinGW and cygwin and msys, please help

Thrashing answered 28/3, 2014 at 8:17 Comment(6)
With cygwin you can emulate in windows the linuk shell, so you can use command like make in windows ;-)Donau
It does what it says on the tin: gives you a Unix-like environment on Windows. Instead of the usual DOS CMD window you get a bash shell and all the usual *nix tools. It's easy enough to install it and try it out - it works pretty well and does not disrupt your Windows environment.Handiwork
is it like if i have a source code for windows... then i can run it on linux if i compile it using cygwin?Thrashing
@Ario, more like the opposite... if you have a linux source code, you can recompile it (with a fair degree of success) to run on windowsKaraite
whats the different between MinGW and Cygwin then?Thrashing
MinGW is a port of some GNU development tools (primarily GCC) that runs on Windows. It compiles code which is written for Windows, to run on Windows. It does not allow you to compile POSIX specific code.Oho
F
22

Because it keeps confusing people:

  1. Cygwin: think of it as an OS. It provides a POSIX C runtime built on top of Windows so you can compile most Unix software to run on top of it. It comes with GCC, and to some extent, you can call the Win32 API from within Cygwin, although I'm not sure that is meant to happen or work at all.

  2. MSYS(2): a fork of Cygwin which has path translation magic to make native Windows programs work nicely with it. Its main goal is to provide a shell so you can run autotools configure scripts. You are not meant to build MSYS applications at all. Note that MSYS2 strives for much more and contains a full-blown package management system so you can easily install MinGW-w64 libraries and tools.

  3. MinGW(-w64): A native Windows port of the GCC compiler, including Win32 API headers and libs. It contains a tiny POSIX compatibility layer (through e.g. winpthreads, the unistd.h headers and some other bits), but you cannot compile POSIX software with this. This is best compared to MSVC, which also produces native code using the Win32 API.

Note that there are MinGW-w64 cross-compilers that run on Cygwin. With MSYS2, I frankly don't see a good reason to do that. Might as well run a VM with Linux if you're going to use Cygwin for that.

Frerichs answered 28/3, 2014 at 8:35 Comment(5)
Would you say Cygwin is like terminal emulator or like a shell on the windows kernel or none of the above?Bullins
No, Cygwin is more like a GNU OS without the kernel, on top of Windows. MSYS(2) is more the shell-like thing.Frerichs
What's the difference between an OS without the kernel and a shell if there's no GUI?Bullins
@JFA the userspace libraries and utilities. The shell is part of the latter. MSYS(2) misses most of the low-level libraries (which for GNU/Linux and Cygwin include a POSIX libc). As for the GUI, Cygwin is capable of running an X server, whereas that is not at all a goal or use for MSYS(2).Frerichs
@rubenvbv A native Windows port of the GCC compiler what is meant by port ? I am not getting clearly.Altonaltona
K
8

More or less from its web page

cygwin is

  1. a POSIX compatibility layer on top of windows API. This is mainly encapsulated in a cygwin1.dll
  2. a distribution system and repository of open source software compiled with this dll.

In a nutshell, if you have a linux source, you can try to recompile for cygwin and be able to run it on windows...

This enables to have accessible many of the typical unix commands (shells, gcc/g++, find....)

Alternatives are:

  • MSYS: are a set of typical unix command implemented in windows.
  • mingw: A gcc/g++ target able to produce win32 programs (note that cygwin gcc/g++ programs will have a dependency on cygwin1.dll that mingw programs will not have).
Karaite answered 28/3, 2014 at 8:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.