With the following C code:
int main() {}
I compile under MSYS2 using gcc -o m2 m2.c
. This gcc is the one installed by pacman -S gcc
; version 4.9.2 target x86_64-pc-msys.
I copy m2.exe
and msys-2.0.dll
to a directory on another PC with a Cygwin installation. If I run m2.exe
from a command prompt it executes correctly, however executing from a Cygwin Bash shell I get the error:
3 [main] m2 (4552) C:\Temp\m2.exe: *** fatal error - cygheap base mismatch detected - 0x180305408/0x180320400.
This problem is probably due to using incompatible versions of the cygwin DLL.
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. Rebooting is also suggested if you
are unable to find another cygwin DLL.
The error message is puzzling as MSYS2 does not have any cygwin1.dll at all.
How do I fix this? Obviously I don't want to delete the Cygwin installation's cygwin1.dll .
The m2
executable does not have any dependencies other than msys-2.0.dll
and built-in Windows DLLs. (I checked with Dependency Walker). It must be something about the binary built with MSYS2 GCC that is meant to search for msys-2.0.dll
but instead finds the installed cygwin1.dll. Is there a workaround?
The output of ldd m2.exe
is:
ntdll.dll => /cygdrive/c/Windows/SYSTEM32/ntdll.dll (0x7ffd12740000)
KERNEL32.DLL => /cygdrive/c/Windows/system32/KERNEL32.DLL (0x7ffd115f0000)
KERNELBASE.dll => /cygdrive/c/Windows/system32/KERNELBASE.dll (0x7ffd0f2b0000)
msys-2.0.dll => /c/Temp/msys-2.0.dll (0x180040000)