tags:

views:

41

answers:

1

I have Cygwin and MinGW(TDM) installed. To build certain projects from source, you have to run a ./configure script, which requires a bash shell and certain unix utilities. For this, the MinGW project distributes MSYS, which is basically an old, stripped-down version Cygwin. I already have Cygwin installed, so I'd rather just use that. What packages would I need to install for Cygwin and how would I need to invoke ./configure so that it knows that I'm trying to use MinGW to build native Windows binaries?

A: 

You are aware that Cygwin comes with a MinGW-compiler and library built in? By using the -mno-cygwin switch you turn the Cygwin gcc into a MinGW gcc. How you'd tweek ./configure to use this is beyond me, but I suppose it would depend on the ./configure script.

What I do is usually to tweek the generated Makefiles by adding the -mno-cygwin switch to the compiler and linker flags.

Thomas Nilsson
This doesn't work with gcc-4. The cygwin developers remove -mno-cygwin in favor of using MinGW.
mathepic
And that means to replace "gcc -mno-cygwin file.c" with something like "mingw-gcc file.c". mingw-gcc would be a gcc compiled to run on one platform (cygwin) and generate binaries for another (mingw). I have yet to move to GCC4 for my cygwin development so I don't know if "mingw-gcc" is included in the cygwin distribution. If so you could tweak the generated Makefiles to use GCC=mingw-gcc.
Thomas Nilsson
[This link](http://lists-archives.org/cygwin/56618-cygwin-1-7-how-do-i-use-gcc-4-and-mingw-to-replace-mno_cygwin.html) points to some hints on how to do this, and the fact that the "real" cross-compiler "isn't quite ready yet".
Thomas Nilsson