This is the mail archive of the cygwin 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: Why are the 32- and 64-bit cygwin1.dlls incompatible?


On Aug 22 09:22, Warren Young wrote:
> If you try something like this from a Cygwin 64 install:
> 
>     $ /cygdrive/c/cygwin32/bin/ls
> 
> you get an error like this:
> 
>     3 [main] ls (8168) C:\cygwin32\bin\ls.exe: *** fatal error -
>     cygheap base mismatch detected - 0x0/0x612A0950.
> 
> It goes on to explain that this is due to trying to load an
> incompatible cygwin1.dll.
> 
> My best guess is that this happens because the standard Windows DLL
> search logic[1] says "oh, I already have a CYGWIN1 module loaded, I
> will use that one."  And boom.
> 
> Yet, if that were truly what's going on, DLL redirection[2] should
> fix it.  From Cygwin 64 again:
> 
>     $ touch /cygdrive/c/cygwin32/bin/ls.exe.local
>     $ /cygdrive/c/cygwin32/bin/ls
>     same complaint as before
> 
> Another oddity is that the inverse test succeeds.  From Cygwin 32:
> 
>     $ /cygdrive/c/cygwin64/bin/ls
>     all   my   base
>     $
> 
> In another forum[3], Yaakov told me that Windows is supposed to be
> taking CPU bitness into account here, which should be another way
> for it to work without special help.  I don't see mention of such a
> rule in [1], however.
> 
> What is really going on here?
> 
> Understand, I'm not asking because I want it fixed.  I mean, it'd be
> *nice* if it were fixed, but I'm more interested in knowing why it
> is the way it is.

When execveing a Cygwin process, a lot of data is submitted via shared
memory, via data copying, and via a special parameter to the
CreateProcess call with the mysterious name "lpReserved2".

One problem is the differences in basic datatypes, which results in
incompatible datastructures between 32 and 64 bit.  While this could be
worked around, this doesn't help for the shared memory stuff, which
depends on the installation path of the cygwin DLL.  The Cygwin DLL in
C:\cygwin1 would use a different name for the shared mem regions than
the Cygwin DLL installed into C:\cygwin2, independent of the target
architecture.  This is by design since Cygwin 1.7.  One effect:  No tty
sharing.

Therefore, interaction between the 32 and 64 bit DLLs is not supported.
This was an early design goal when we discussed the 64 bit DLL on the
cygwin-developers list two years ago, but I was almost the only one
favoring this approach, AFAIR.  It also turned out that the complexity
of this approach was pretty high, so we discussed it again early 2013
and I dropped it, otherwise we would very likely not have a 64 bit
distro at this time.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: pgpFVk5ly3dmE.pgp
Description: PGP signature


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