'Asymptote compiled on Git Bash gives Cygwin Error

I recently installed Asymptote 2.78 and GhostScript 9.55 (as the MikTeX installation on Windows screws them both). I also deleted the old MikTeX packages. I wanted to compile a LaTeX file with asymptote code in it. When I compile it, MikTeX again downloads the old Asymptote (which I then delete) and produces a *.asy file. I have the asymptote exe here: C:\Program Files\Asymptote\asy.exe. When I run it on my *.asy (on GIT BASH), it produces the follwing error:

  0 [main] asy (5248) C:\Program Files\Asymptote\asy.exe: *** fatal error - cygheap base
  mismatch detected - 0x180349408/0x180346408.
  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.

Now here's the funny bit: I have not installed Cygwin on my Windows machine whatsoever. I even searched my computer using the Everything Search engine. There is no other cygwin1.dll. But there are some other cygwins belonging to Git. When I run the stuff from Windows Command Prompt, it works (even when I do not delete the MikTeX asy)! This is when I do latexmk -pdf *.tex on cmd prompt. I do not understand what is going on. Please help!!



Solution 1:[1]

Check first if a rebase of the msys-2.0.dll, as I suggested before, would work. (Do it in C:\Program Files\Git\usr\bin and C:\Program Files\Git\bin)

Make sure to use the latest Git For Windows.

The alternative would be to use WSL2 and benefit from a full-fledged Linux environment.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 VonC