Subject: Re: merging mingw and cygwin
From: Edward Peschko <[email-masked]>
To: Andrew DeFaria <[email-masked]>
Cc: [email-masked]
Date: Mon, 13 Oct 2003 12:00:00 -0700

> Have you tried to compile an application using -mno-cygwin? Have you 
> tried to run the resulting executable? I have. I created an application 
> using -mno-cygwin and to my surprise it became "Windows" like in that 
> thinks like pathnames had to be specified in Window'ese. So before, in 
> the Cygwin environment I could:

yes, I've tried that, and yes, it points out the redudancy of the two projects.
My point(s) are:

	a) that it is not a good fit. It does a 'good job'
	b) its a big usability issue.

For example, see 'results of compiling berkeleydb'. cross-compilation in general
is a big pain, and its hard to do right. Not to repeat what I said there, but simply
do the following experiment:

mingw > gcc -dM -e -xc /dev/null

and you get:

---- mingw ----
#define _WIN32 1
#define _X86_ 1
#define __HAVE_BUILTIN_SETJMP__ 1
#define __i386__ 1
#define __SIZE_TYPE__ unsigned int
#define __GNUC_PATCHLEVEL__ 3
#define _stdcall __attribute__((__stdcall__))
#define __MSVCRT__ 1
#define __USER_LABEL_PREFIX__ _
#define __tune_pentium__ 1
#define __STDC_HOSTED__ 1
#define __WIN32 1
#define __stdcall __attribute__((__stdcall__))
#define __WCHAR_TYPE__ short unsigned int
#define __MINGW32__ 1
#define WIN32 1
#define __WINT_TYPE__ short unsigned int
#define __GNUC__ 3
#define _cdecl __attribute__((__cdecl__))
#define __tune_i586__ 1
#define __WINNT 1
#define __WINNT__ 1
#define __fastcall __attribute__((__fastcall__))
#define _fastcall __attribute__((__fastcall__))
#define __USING_SJLJ_EXCEPTIONS__ 1
#define __WIN32__ 1
#define WINNT 1
#define __GXX_ABI_VERSION 102
#define i386 1
#define __GNUC_MINOR__ 2
#define __STDC__ 1
#define __PTRDIFF_TYPE__ int
#define __REGISTER_PREFIX__ 
#define __cdecl __attribute__((__cdecl__))
#define __NO_INLINE__ 1
#define __i386 1
#define __VERSION__ "3.2.3 (mingw special 20030504-1)"
#define __declspec(x) __attribute__((x))
---- mingw ----

cygwin > gcc -mno-cygwin -dM -e -xc /dev/null

---- cygwin ---- 
#define __DBL_MIN_EXP__ (-1021)
#define __FLT_MIN__ 1.17549435e-38F
#define _WIN32 1
#define _X86_ 1
#define __CHAR_BIT__ 8
#define __WCHAR_MAX__ 65535U
#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
#define __FLT_EVAL_METHOD__ 2
#define __i386__ 1
#define __SIZE_TYPE__ unsigned int
#define __DBL_MIN_10_EXP__ (-307)
#define __FINITE_MATH_ONLY__ 0
#define __GNUC_PATCHLEVEL__ 1
#define __FLT_RADIX__ 2
#define __LDBL_EPSILON__ 1.08420217248550443401e-19L
#define _stdcall __attribute__((__stdcall__))
#define __SHRT_MAX__ 32767
#define __LDBL_MAX__ 1.18973149535723176502e+4932L
#define __MSVCRT__ 1
#define __LDBL_MAX_EXP__ 16384
#define __LONG_MAX__ 2147483647L
#define __SCHAR_MAX__ 127
#define __DBL_DIG__ 15
#define __USER_LABEL_PREFIX__ _
#define __STDC_HOSTED__ 1
#define __WIN32 1
#define __stdcall __attribute__((__stdcall__))
#define __LDBL_MANT_DIG__ 64
#define __FLT_EPSILON__ 1.19209290e-7F
#define __tune_i686__ 1
#define __LDBL_MIN__ 3.36210314311209350626e-4932L
#define __WCHAR_TYPE__ short unsigned int
#define __MINGW32__ 1
#define __FLT_DIG__ 6
#define __FLT_MAX_10_EXP__ 38
#define __INT_MAX__ 2147483647
#define WIN32 1
#define __FLT_MAX_EXP__ 128
#define __DECIMAL_DIG__ 21
#define __DBL_MANT_DIG__ 53
#define __WINT_TYPE__ unsigned int
#define __GNUC__ 3
#define _cdecl __attribute__((__cdecl__))
#define __LDBL_MIN_EXP__ (-16381)
#define __LDBL_MAX_10_EXP__ 4932
#define __DBL_EPSILON__ 2.2204460492503131e-16
#define __DBL_MAX__ 1.7976931348623157e+308
#define __tune_pentiumpro__ 1
#define __fastcall __attribute__((__fastcall__))
#define _fastcall __attribute__((__fastcall__))
#define __USING_SJLJ_EXCEPTIONS__ 1
#define __DBL_MAX_EXP__ 1024
#define __WIN32__ 1
#define WINNT 1
#define __FLT_DENORM_MIN__ 1.40129846e-45F
#define __LONG_LONG_MAX__ 9223372036854775807LL
#define __FLT_MAX__ 3.40282347e+38F
#define __GXX_ABI_VERSION 102
#define __FLT_MIN_10_EXP__ (-37)
#define __FLT_MIN_EXP__ (-125)
#define i386 1
#define __GNUC_MINOR__ 3
#define __DBL_MAX_10_EXP__ 308
#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L
#define __DBL_MIN__ 2.2250738585072014e-308
#define __PTRDIFF_TYPE__ int
#define __LDBL_MIN_10_EXP__ (-4931)
#define __REGISTER_PREFIX__ 
#define __cdecl __attribute__((__cdecl__))
#define __LDBL_DIG__ 18
#define __NO_INLINE__ 1
#define __i386 1
#define __FLT_MANT_DIG__ 24
#define __VERSION__ "3.3.1 (cygming special)"
#define __declspec(x) __attribute__((x))
---- cygwin ---- 

In other words, depending how you look at it, mingw is defining less crucial 
information, or cygwin is defining more junk. And sometimes they define
the same stuff differently.

In any case, the toolsets are incompatible. And this is just the tip 
of the iceberg; If mingw's compiler is doing *anything* different from 
cygwin, and the users of large mingw projects are testing versus mingw, then
the using of cygwin will result in binaries with annoying, hard-to-find bugs.

Ed

> 
> $ myapp /path/to/file
> 
> but now, after -mno-cygwin I must:
> 
> $ myapp C:\\path\\to\\file
> 

That's what I really don't understand about cygwin and mingw32, both. Why
can't they make a mutual convention: to take things of the form 
/path/to/file and change them to C:/cygwin/path/to/file, things of the form
/cygdrive/c/path/to/file and make this C:/path/to/file, and always use the
internal form 'C:/path/to/file' to open files? 

ie - if programs are running under sh.exe, massage at the *shell* level, 
not let individual applications manage their arguments.

> Without Cygwin's POSIX emulation pathnames don't translate very well. 
> That's probably not the only thing that you'll find as "non-unix-like" 
> in the runtime environment. As such I would think producing MingW only 
> versions of the various Cygwin apps would be from problematic to 
> impossible, however, you are welcomed to try if you'd like to expend the 
> energy...

well, there is a project called unxutils whose goal is to do exactly this; 
they use mingw32 to compile, so I'm assuming that if and when mingw32 and
cygwin were merged, they would make a good test suite to make sure everything
is working correctly.

Ed

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