Cygwin: How to actually use gcc-mingw

DevSolar picture DevSolar · Sep 23, 2010 · Viewed 45.9k times · Source

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...

Answer

ak2 picture ak2 · Sep 23, 2010

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.