4

I'm trying to execute a .sh script (that wasn't written by me) and I get the following error:

0 [main] echo (5320) C:\Program Files\Git\usr\bin\echo.exe: *** fatal error - cygheap base mismatch detected - 0x180343408/0x180317408. 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.

I tried to follow the instructions in the error but I only have one cygwin1.dll file.

So I tried to execute the following command in a git bash shell:

/c/cygwin/bin/man

and I get:

0 [main] man (11952) C:\cygwin\bin\man.exe: *** fatal error - cygheap base mismatch detected - 0x180317408/0x180343408. 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

I already tried to disable ASRL options in the exploit protection panel (as suggested by somebody) and reboot but that didn't fix the problem.

If I write

which -a cygwin1.dll

I get:

/c/cygwin/bin/cygwin1.dll

/c/cygwin/bin/cygwin1.dll

It looks like I have two cygwin1.dll but actually I only have one.. I have been searching for a possible solution since days but nothing seems to work for me. Any suggestion?

Community
  • 1
  • 1
Harry
  • 188
  • 1
  • 12
  • Does this answer your question? [Cygwin/Git error cygheap base mismatch detected](https://stackoverflow.com/questions/8107319/cygwin-git-error-cygheap-base-mismatch-detected) – T.Todua May 22 '23 at 14:52

3 Answers3

6

While the error message is mentioning cygwin1.dll, it is misleading as the Git for Windows is using MSYS and the file was renamed msys-2.0.dll

Unfortunately the MSYS team forgot to change the error messages when they imported and modified the Cygwin source:

enter image description here

matzeri
  • 8,062
  • 2
  • 15
  • 16
1

I encountered the same problem while trying to build a certain C/C++ project from source in the Git Bash Terminal. Based on the previous answers by @Harry and @matzeri it seems that Git Bash is what is causing this problem. To resolve it I had to disable ASLR for all executables in my Cygwin install folder (Usuall C:\cygwin64) using the command

Get-Item -Path "C:\cygwin64\bin\*.exe" | %{ Set-ProcessMitigation -Name $_.Name -Disable ForceRelocateImages }

I restarted the computer and then switched to using Cygwin Terminal and compiled from there.

NB: Cygwin Terminal comes by default with Cygwin installation

enter image description here

AguThadeus
  • 310
  • 2
  • 10
  • This answer put me on right track. When I upgraded to latest npm on windows 10 using GitBash npm started getting the first error message from question. It started working when I found and renamed the file `/anaconda3/Library/usr/bin/msys-2.0.dll` – Andrew Allaire Aug 02 '23 at 17:29
0
  • Find all the msys-2.0.dll's on your machine and add the suffix .bkp to them.
  • Wherever you found them at, copy "C:\Program Files\Git\usr\bin\msys-2.0.dll" to those locations.

VoidTools Everything screenshot of msys-2.0.dlls

Notes:

  • If you were to copy from C:\msys64\usr\bin\msys-2.0.dll to all other locations, then you lose that nice additional text at the end that shows the branch you're on (master) Shows what branch you're on
    • Same goes if you just decide to delete all the extra dlls and just add C:\msys64\usr\bin to your path, there must be a dependencies it looks for relative to the directory it normally resides.
  • Because apparently I skimmed the selected answer and missed the part about msys-2.0.dll, I had to figure this out myself. For future reference:
Derek Ziemba
  • 2,467
  • 22
  • 22