delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/05/06/22:14:30

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 <brian AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: Bob Rossi <bob_rossi AT cox DOT net>
CC: cygwin AT cygwin DOT com
Subject: Re: Newbie needs help using mingw with cygwin
References: <loom DOT 20080506T012312-150 AT post DOT gmane DOT org> <E1JtC2R-0006lX-F2 AT ciao DOT gmane DOT org> <BLU145-W2465742F9F668F6A6E4FBCEED60 AT phx DOT gbl> <20080506231036 DOT GA27910 AT ednor DOT casa DOT cgf DOT cx> <loom DOT 20080506T232849-171 AT post DOT gmane DOT org> <20080506235700 DOT GA28066 AT ednor DOT casa DOT cgf DOT cx> <loom DOT 20080507T002123-723 AT post DOT gmane DOT org> <48210A92 DOT 6A9674F6 AT dessent DOT net> <20080507015527 DOT GC14306 AT brasko DOT net>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019