X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Message-ID: <4821106A.AA21BF3E@dessent.net> Date: Tue, 06 May 2008 19:14:02 -0700 From: Brian Dessent X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) MIME-Version: 1.0 To: Bob Rossi CC: cygwin AT cygwin DOT com Subject: Re: Newbie needs help using mingw with cygwin References: <20080506231036 DOT GA27910 AT ednor DOT casa DOT cgf DOT cx> <20080506235700 DOT GA28066 AT ednor DOT casa DOT cgf DOT cx> <48210A92 DOT 6A9674F6 AT dessent DOT net> <20080507015527 DOT GC14306 AT brasko DOT net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Bob Rossi wrote: > I've been wondering about this. Why is it necessary to "cross-compile" > from cygwin to mingw when the cygwin environment has the native mingw > compiler? To me, it seems like if the mingw compiler is capable of > running in the build environment, it should just be called and work. It depends on how the package is written. But really, if you don't tell configure that you're cross compiling (i.e. that build and host are not the same) you're lying to it and you set yourself up for features of the build system being detected that the host doesn't really support. For example, say there's a configure test to see if "/proc" exists and is usable. If you don't tell configure that you're cross compiling the test will succeed since Cygwin does support /proc, and this might enable some #define that enables a codepath in the app where it tries to use /proc at runtime. But if you're compiling with the MinGW compiler, enabling this codepath is nonsense because it won't work at runtime; a MinGW app opening /proc is meaningless. It detected a feature of the build system that is not actually present on the host system because you lied to configure. If the test is properly written however it won't be run when cross compiling, since detecting features of the build system doesn't make sense in that case. It has nothing to do with the fact that Cygwin gcc has a -mno-cygwin switch. Think of the case where you're building on a Linux system with a MinGW cross compiler. The MinGW cross compiler is a linux application, just like Cygwin's gcc -mno-cygwin is a Cygwin application. But you would never think to check features of the Linux build system in order to determine which codepaths to enable for the MinGW app, so why is Cygwin any different? Just because Cygwin can run MinGW programs doesn't mean it's still not cross compiling conceptually. > Is the cygwin mingw compiler a cross compiler? or is it the actual > native mingw compiler? I assume that you mean "gcc -mno-cygwin" here. This is still Cygwin gcc, just put into MinGW personality mode. So it recognises POSIX paths, but the output is the same as would be generated by the MinGW gcc, so it's for all intents and purposes a host=cygwin target=mingw cross. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/