This is the mail archive of the cygwin@cygwin.com 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


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

There's one more GOTCHA. Cygwin GCC will look in /usr/lib no matter what.
Thus if it finds a library in there that it doesn't find in /usr/lib/mingw,
it will use it. That means when your configure script looks for a library
that MinGW does not support, it believes that you do have it, and it will
try to link it. Most of the time, MinGW does support the libraries that a
configure script is looking for. So you may not have to worry about it.
However, there is a workaround for this too.

I wrote a detailed document on this topic, and it's posted on OpenLDAP's web
site in their FAQ section:

	http://www.openldap.org/faq/data/cache/301.html

It will explain how to fix the last GOTCHA as well...

Jon

> -----Original Message-----
> From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com]On Behalf
> Of J. Henning Schwentner
> Sent: Saturday, January 05, 2002 7:42 AM
> To: cygwin@cygwin.com
> Subject: Compiling apps to Mingw32 with cygwin
>
> Hi,
>
> I am trying to compile SDL-1.2.3 for mingw32 with cygwin-1.3.6.
> I use the following steps:
> 	$ ./configure --host=pc-i386-mingw32
> 	# make
>
> It compiles without errors, but the outcoming SDL.dll has references to
> cygwin1.dll not to MSVCRT.dll.
>
> I have also installed Mingw32-1.1. Do I have to use the gcc from the
> mingw-distribution or can I use the cygwin-gcc? If I have to use the
> mingw-gcc, how can I tell this to configure?
>
> Thanks in advance!
>
> Henning
>
> P.S: Please CC me, I am not on the list
>
> --
> J. Henning Schwentner
> Lanthan Software KG
>
> _________________________________________________________
> 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/
>


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


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