This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Compiling apps to Mingw32 with cygwin

> Subject: RE: Compiling apps to Mingw32 with cygwin
> Date: Sat, 5 Jan 2002 11:35:14 -0800
> From: "Jon Leichter" <>
> Reply-To: "Jon Leichter" <>
> To: "J. Henning Schwentner" <>
> CC: <>
> Hi Henning.
> You can use Cygwin's GCC. It's just a little more involved. Here's a short
> answer. When you configure, do so like this:
>         $ env CC="gcc -mno-cygwin" ./configure --host=i386-pc-mingw32
> Notice that your --host specification was a little off. The way that I have
> specified it is the standard way. If your configure script uses the format
> that you've specified then your format is correct.
> If your configure script uses Libtool, then the above method will not be
> sufficient. Libtool likes to strip the -mno-cygwin switch off at link time.
> For this, I use a wrapper script for MinGW. It's called mgcc, and it looks
> like this:
>         $ cd /usr/bin
>         $ cat > mgcc
>         gcc -mno-cygwin $*
>         ^D
> Now your configure line looks like this:
>         $ env CC=mgcc ./configure --host=i386-pc-mingw32

> Subject: Re: Compiling apps to Mingw32 with cygwin
> Date: Sun, 6 Jan 2002 14:57:23 +0100
> From: "J. Henning Schwentner" <>
> To: <>
> Thanks for your quick help, this works nice!
> But, it is a bit difficult. I think ideally configure should detect
> --host=mingw32 --build=cygwin and in this case should add --mno-cygwin to
> CFLAGS and CPPFLAGS (and do something to fix libtool).

Both of these are incorrect and both say the same thing as far as
configure is concerned.  You need to specify the full triplet when using
`gcc -mno-cygwin' as your compiler.  The method used above tells
configure that your cross compiling wanting to build an executable for
i386-pc-mingw32 using i686-pc-cygwin.  Instead you should:

CC='gcc -mno-cygwin' CXX='g++ -mno-cygwin' ./configure
--host=i386-pc-mingw32 --build=i386-pc-mingw32 --target=i386-pc-mingw32

OR (if your config.guess and config.sub support it)

CC='gcc -mno-cygwin' CXX='g++ -mno-cygwin' ./configure --host=mingw32
--build=mingw32 --target=mingw32

You probably currently see configure scripts check for cross compiling
and end up with a value of `no' because the executable can be executed. 
This method, IIRC, has changed as of autoconf-2.50 which now compares
the values of host and build to determine the value for cross compiling.


Do You Yahoo!?
Get your free address at

Unsubscribe info:
Bug reporting:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]