cc1.exe 中的 MSYS2 gcc 致命错误:检测到 cygheap 碱基不匹配

MSYS2 gcc fatal error in cc1.exe: cygheap base mismatch detected

此特定错误已在 Stack Overflow 上的多个其他上下文中出现,通常与 Cygwin 或 git(并涉及其他可执行文件)有关。我没有在 MSYS2 的上下文中看到这个,我不确定如何解决它。这是在使用 pacman -S gcc 的全新安装的 MSYS2 上发生的,它安装了 gcc 版本 9.3.0。当我转到 运行 我的 makefile 时,这是出现的错误:

0 [main] cc1 (2724) C:\msys64_close\usr\lib\gcc\x86_64-pc-msys.3.0\cc1.exe: 
*** fatal error - cygheap base mismatch detected - 0x180346408/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.

文件 cygwin1.dll 在 msys64 文件夹中不存在。 MSYS2 主页指出:

Cygwin provides a runtime library called cygwin1.dll that provides the POSIX compatibility layer where necessary. The MSYS2 variant of this library is called msys-2.0.dll...

我不确定问题出在 gcc 还是 MSYS2 上。我尝试从 http://repo.msys2.org/ 安装旧版本的 gcc,但每次我尝试使用低于 9.3.0 的版本时,我都会收到警告,由于未解决的依赖关系,gcc 无法“升级”。

如有任何帮助,我们将不胜感激。

问题是 msys-2.0.dll 与程序的 makefile 位于同一目录中,与以下目录中的同一文件不匹配:

msys64/usr/bin

我基本上有这个文件的旧版本,并且由于它们不匹配,所以产生了上述错误。如果您遇到这个问题,您需要将上面的较新版本复制并粘贴到您正在编译软件的目录中(对我来说,它是包含 makefile 的目录)。完成后,软件编译无误。