Subject: RE: Compiling apps to Mingw32 with cygwin
From: "Jon Leichter" <[email-masked]>
To: <[email-masked]>
Cc: "J. Henning Schwentner" <[email-masked]>, "CU List" <[email-masked]>
Date: Mon, 7 Jan 2002 08:32:54 -0800

Some comments:

- In every configure script I've seen, the build and target variables
receive the value assigned to host if they're not explicitly specified. This
behavior is part of autoconf and not the script writer. Perhaps this is
changing in autoconf 2.50. I don't happen to know those details.

- Building MinGW binaries in a Cygwin environment is kind of like a
cross-compile, and kind of not. I heard enough people take both positions,
so it's seems to have become religious point of view.

- Your specification of CXX is correct if you're project is using C++. I
have not been using C++ in the projects that I built, so I left it out.
Also, since I've never built like that, I didn't think it'd be appropriate
for me to mention it as if I'd know it would work.

- Using CC="gcc -mno-cygwin" is good for compiling, but it's bad for GNU
Libtool, as I have mentioned. I use a wrapper script: CC=mgcc. What do you
think of this Earnie?

Jon

> -----Original Message-----
> From: Earnie Boyd [mailto:[email-masked]]
> Sent: Monday, January 07, 2002 6:29 AM
> To: CU List
> Cc: Jon Leichter; J. Henning Schwentner
> Subject: 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" <[email-masked]>
> > Reply-To: "Jon Leichter" <[email-masked]>
> > To: "J. Henning Schwentner" <[email-masked]>
> > CC: <[email-masked]>
> >
> > 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" <[email-masked]>
> > To: <[email-masked]>
> >
> > 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/