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: Spurious "You have multiple copies of cygwin1.dll on your system."

On Thu, 7 Oct 2004, luke.kendall wrote:

> On  7 Oct, Christopher Faylor wrote:
> >  On Thu, Oct 07, 2004 at 02:49:29PM +1000, luke.kendall@XXXXX.XXXXX.XXX.XX wrote:


> > >After installing Cygwin by using a shell script running by executing
> > >bash from a network-installed Cygwin, the script fails when it tries to
> > >run a post-install script.  The error reported is:
> > >
> > >    bash-2.05b$ -which latest -fresh
> > >    c:\cygwin\bin\bash.exe (3208): *** cygheap version mismatch detected - 0x616D0000/0x61780000.
> > >    You have multiple copies of cygwin1.dll on your system.
> > >    Search for cygwin1.dll using the Windows Start->Find/Search facility
> > >    and delete all but the most recent version.  The most recent version *should*
> > >    reside in x:\cygwin\bin, where 'x' is the drive on which you have
> > >    installed the cygwin distribution.
> > >
> > >A search showed that there really is only c:\cygwin\bin\cygwin1.dll -
> > >the message is wrong.
> > >
> > >I'd say the sanity-check is detecting cygwin1.dll associated with the
> > >bash that's running from the network-mounted drive.
> >
> > You wouldn't say that if you knew what "cygheap" was.  This is an
> > indication that a child executable is detecting that its cygheap is
> > not at the same location as the parent.  Since the cygheap lives at
> > the end of the cygwin DLL it's hard to see how this could be anything
> > other than two different versions of cygwin being invoked.
> Okay, and in fact there are two (possibly different) versions of
> cygwin1.dll available to be loaded into memory.  I don't know why
> Cygwin attempted to load the freshly-installed cygwin1.dll, though.
> It wasn't on the PATH of the network-loaded shell script.

As Dave said, Windows loads the DLLs from the app directory before going
through the PATH.  I'd bet there's a /bin/sh (or something of the sort)
call in the post-install script, which, after you've changed the mounts,
points to c:/bin (which is the newly-installed Cygwin).

Basically, it's not enough to share the network directory -- you also have
to have the "/", "/usr/bin", and "/usr/lib" mounts pointing to it for the
network copy of Cygwin to work properly.  So, your mount changing idea may
not be so off the mark after all, but in the other direction (i.e., switch
"/" back to the network drive)...  Unfortunately, anything written to
those directories will then also go back to the network drive, which isn't
what you want.  Sort of a Catch-22 here...

One question is: do you have to use the actual POSIX paths in your install
script?  If you can have a uniquely-named mount (say, "/local-install"),
and use that in your install script (e.g., "/local-install/bin", etc), you
should be able to circumvent this issue.  Since you're the administrator,
you can just decree that your users shan't have a mount named
"/local-install" on their existing Cygwin installations).

> To be pedantic, the warning is wrong because it says you have multiple
> copies of cygwin1.dll on your system.  There aren't, and indeed a
> Search for cygwin1.dll using the Windows Start->Find/Search facility
> confirms that there is only a single cygwin1.dll, freshly installed.

Well, network drives are technically drives on your system too.  If you
can't find multiple copies of cygwin1.dll on your local drives, but an
extra copy exists on a network drive, the error is correct.

> Try this: from a machine on your network, with Cygwin installed, share
> the c:/cygwin directory (i.e. the path where you installed Cygwin).
> On another PC, start a DOS window.  set PATH=this network Cygwin path
> Type bash.  You get a bash prompt.
> Now you have a situation where cygwin1.dll is loaded in memory from
> across the network.  And if you have Cygwin installed on the local
> machine, you don't get error messages about multiple Cygwin versions
> installed on your PC.  You can run all the Cygwin commands.

...Until you use an absolute path to invoke a command (e.g., /bin/sh) with
mounts pointing to the local installation...

> So even knowing that the error message is imprecise and misleading in
> this situation, and that it probably means that Cygwin tried to load up
> cygwin1.dll from a different path to a copy that's already loaded, and
> that it's incompatible with the one that's already loaded, I don't know
> why Cygwin is trying to load this other DLL.


> I suspect the error message should be "Attempting to load an
> inconsistent version of cygwin1.dll".

How's "version mismatch" different from "inconsistent version"?

> I freely confess I'm doing something unusual.  Maybe I'm the first
> person on the planet to attempt to automate Cygwin installation via a
> shell script from an already existing and stable copy of Cygwin
> installed elsewhere on the network?

Likely you are.  There just aren't that many people using Cygwin, and even
fewer that are administering it (and even fewer that are doing it
remotely, I guess).

I'm about to tread onto the grey area here, and would like to disclaim
that this is in no way approved by the Cygwin team:

*If* you know what you're doing, and *if* you're careful, and *if* you
have a real need (which I suspect you do in this case), you *can* run two
mismatched versions of Cygwin occasionally.  Take a look at the way the
Cygwin test suite is run -- it runs with a newly-built DLL all the time.
Note that you'll need to have a unique cygheap id for the network copy of
Cygwin that is guaranteed to differ from any installed Cygwin's id.  The
easiest way to do that is have your network Cygwin built with debugging
enabled.  As long as you don't try doing anything exotic (e.g., start
network services using both copies of cygwin1.dll), it should work.

Combined with the idea for a uniquely-named mount for the local Cygwin
install (i.e.: save local mounts; mount network Cygwin properly;
mount local "/" on "/local-install" [with local "/usr/bin" and "/usr/lib"
mounted accordingly]; run script; restore local mounts), the above should
give you a working installation procedure (text/binary issues aside).

> Anyway, I'll keep battering away at the attempt, and see if I can find
> something on cygheap so I understand more about what's going on.
> Thanks,
> luke

      |\      _,,,---,,_
ZZZzz /,`.-'`'    -.  ;-;;,_
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Happiness lies in being privileged to work hard for long hours in doing
whatever you think is worth doing."  -- Dr. Jubal Harshaw

Unsubscribe info:
Problem reports:

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