This is the mail archive of the
mailing list for the Cygwin project.
Re: Newbie needs help using mingw with cygwin
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
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html