This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: Compiling apps to Mingw32 with cygwin
- From: Earnie Boyd <earnie_boyd at yahoo dot com>
- To: CU List <Cygwin at Cygwin dot Com>
- Cc: Jon Leichter <jonleichter at mediaone dot net>, "J. Henning Schwentner" <hschwentner at yahoo dot com>
- Date: Mon, 07 Jan 2002 09:29:08 -0500
- Subject: Re: Compiling apps to Mingw32 with cygwin
- References: <3C391A0A.758D073@yahoo.com>
- Reply-to: CU List <Cygwin at Cygwin dot Com>
> Subject: RE: Compiling apps to Mingw32 with cygwin
> Date: Sat, 5 Jan 2002 11:35:14 -0800
> From: "Jon Leichter" <jonleichter@mediaone.net>
> Reply-To: "Jon Leichter" <jon@symas.com>
> To: "J. Henning Schwentner" <hschwentner@yahoo.com>
> CC: <cygwin@cygwin.com>
>
> 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" <hschwentner@yahoo.com>
> To: <cygwin@cygwin.com>
>
> 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.
Earnie.
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/