I am a software developer. I like cross-platform development. And I prefer lower level programming language like C. My OS is Windows. Thus, I normally use Visual Studio Express Edition to compile the source code. But using Microsoft Visual C++ compiler is not a good idea for cross-platform development, because it highly depending on the Microsoft platform. Besides that, it doesn’t have C99 standard.
So, the best cross-platform C and C++ compiler is GCC (GNU Compiler Collection). However, it is used in Unix-like OS. Yet, there are two projects porting GCC to Windows: MinGW and Cygwin. These two projects provide us GCC to compile cross-platform source code such as libjpeg, libpng, zlib, etc. This indicates that, we can also write our own cross-platform source code and compiled by using GCC in Windows and other Unix-like OSes.
However, there are limitations and advantages for both projects. Cygwin is more powerful to develop the cross-platform applications. This is because Cygwin provides a POSIX layer on Windows. Therefore, it is able to compile the source code which depends on X11, pthreads, etc. As a result, we can use Cygwin to compile some of the libraries that Visual C++ cannot compile.
On the other hand, MinGW is highly depends on Win32 API. Therefore, MinGW cannot compile the source code depends on X11. And because of this limitation, several cross-platform libraries downloaded from Internet are difficult to be compiled under MinGW.
Therefore, Cygwin can be considered better than MinGW in the sense of software development. However, there is licensing issue about Cygwin. Using Cygwin to develop an application will link against cygwin1.dll. And, this cygwin1.dll is released under GPL license. Consequently, the applications or libraries linking against cygwin1.dll will be affected by GPL license. Cygwin licensing terms mention:
In accordance with section 10 of the GPL, Red Hat permits programs whose sources are distributed under a license that complies with the Open Source Definition [See http://www.opensource.org/docs/osd/ for the precise Open Source Definition and a list of the licenses certified by OSI as conforming to that definition] to be linked with libcygwin.a/cygwin1.dll without libcygwin.a/cygwin1.dll itself causing the resulting program to be covered by the GNU GPL. [Cygwin API Licensing Terms]
As a result, the applications and libraries need not be GPLed, but must be open source and conform to Open Source Definition. MinGW which doesn’t depend on cygwin1.dll allows permissive license. That means, if we develop an application using MinGW, we can commercialise the application and make the application close source. Therefore, in the sense of commercialisation, MinGW is more suitable to be used.
Actually, Cygwin has a feature allows us to build the application without linking against cygwin1.dll. We can do this by using “-mno-cygwin” during the linking of the objects and libraries. This is because Cygwin provides MinGW runtime libraries. That means we can use Cygwin as it is MinGW, but giving up the POSIX related functions.
Because of the licensing term, I am very confused. And I also emailed and asked for the information about the Cygwin licensing terms. But nobody can a definitive answer. Since Cygwin license allows linking to cygwin1.dll with the Open Source Definition, that means if library A is zlib/libpng license, it will not be GPLed. Then, the question is, if another library, B, linked against library A, which is zlib/libpng, yet A linked against cygwin1.dll, could we commercialise the library B without open source?
Still very doubtful.