首页 > 解决方案 > git for windows中的cygheap不匹配错误

问题描述

尝试在 Git Bash 中运行 shell 脚本。这个特定的脚本需要 Rcpp 和 RcppArmadillo 包。(创建一个用 C++ 实现的 R 包)因为我在 Windows 系统上,所以我必须安装 Rtools40。执行sh命令后,我收到错误:

fatal error - cygheap base mismatch detected - 0x180316408/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.

我试过的:

  1. 按照错误消息中的说明进行操作。但是,对 cygwin1.dll 的搜索结果为空。此外,我从未在我的机器上安装过 Cygwin。
  2. 将 R、Rtools40 和 Git for Windows 更新到最新版本。这是非常需要的(显然 Windows 不会自动更新这些程序sigh)但它没有解决错误消息。
  3. 如本文本文所述,在 Windows 安全设置中关闭 ASLR 保护。
  4. 从我的驱动器中删除重复的 msys-2.0.dll 文件。这最终奏效了。我将详细发布解决方案作为这个问题的答案。

希望这对像我一样一直在筛选许多没有完全回答这个问题的帖子的人有所帮助。

标签: windowsgitcygwinshmsys2

解决方案


所以这就是我解决这个问题的方法。据我了解,Git Bash 中的错误消息已经过时且具有欺骗性。它引用了 Cygwin,但 Git Bash 实际上使用的是 MSYS2,而不是 Cygwin。因此,我不需要搜索 cygwin1.dll,而是需要在我的驱动器中搜索 msys-2.0.dll。该文件存在于两个位置:Git\usr\bin 和 rtools40\SOMETHING(我不记得确切的路径,但它与 Rtools40 相关联)。根据错误消息中的说明,我删除了较旧的版本,它恰好是与 Rtools40 相关联的版本。我的驱动器上只剩下一个版本的 msys-2.0.dll,然后该sh命令在 Git Bash 中执行,没有任何问题。

我仍然困惑的是:为什么 Git Bash 中的错误消息没有更新?Cygwin 和 MSYS2 有什么区别?我知道它们都在 Windows 上强加了 UNIX 环境,但是其中一个有优点还是缺点?从长远来看,如果我想通过命令行执行脚本,Git Bash 是可持续的,还是应该只在我的机器上创建一个 Linux 分区?


推荐阅读