Since "gcc -mno-cygwin" does not work anymore, I was looking for a way to get a MinGW-targeted GCC running within my Cygwin environment. (Running a MSYS environment is not an option at this point.)
The Cygwin installer offers a package "gcc-mingw", which installs, among others:
lib/gcc/i686-pc-mingw32/3.4.4/cc1.exe
lib/gcc/i686-pc-mingw32/3.4.4/collect2.exe
lib/gcc/i686-pc-mingw32/3.4.4/crtbegin.o
lib/gcc/i686-pc-mingw32/3.4.4/crtend.o
What is absent is the "gcc" frontend. So, how do I actually invoke this compiler? I hopefully don't have to go through "cc1" manually, have I?
I googled, but couldn't find anything relevant on the subject...
As you already found, you can use gcc-3 with -mno-cygwin
. The other possibility is to install the 32-bit and/or 64-bit toolchains from the MinGW-w64 project, which have been packaged for Cygwin very recently and hence are available through setup.exe now. Don't be put off by the rather confusing executable names: i686-w64-mingw32-gcc
is the 32-bit compiler and x86_64-w64-mingw32-gcc
is the 64-bit one.
This actually works. Any idea why they keep an apparently non-functional package "gcc-mingw" in there and hide the working stuff as "i686-w64-mingw32-gcc"?
I think the gcc-mingw packages are part of the
gcc-3 -mno-cygwin
functionality. They don't actually contain anything except postinstall scripts that create links which I guess are needed for that. Those funny names follow the usual target triplet pattern for cross-compilers: cpu-vendor-os, with vendor==w64 (for MinGW-w64) and os==mingw32 (for hystorical reasons).Note that as of June '12 at least, the string to run the MinGW compiler from Cygwin after installing the toolchain is simply
mingw-gcc
. This resolves the issue raised by the comments in the post below.Just be careful which mingw-toolchain you use. The "true" mingw32 is win32-based ("mingw-gcc" probably being from that and not from the cygwin gang) and use Windows paths e.g. They are thus somewhat incompatible with the cygwin native versions (producing .d files with different path notations etc.). The cygwin-based gcc4 cross-compiler is one of the two mentioned in the answer.