未捕获的异常失败("input_value: bad bigarray kind")- Windows 和 Mgt 开发环境一致

Uncaught exception Failure("input_value: bad bigarray kind") - Unison on Windows and Mgt Development Environment

我在 Windows 8.1 上使用 Mgt 开发环境 (mgtcommerce/mgt-development-environment-5.6)。 & Windows 的 DockerToolbox。

我还从 https://www.mgt-commerce.com/documentation/mgt-development-windows-file-synchronization 下载了建议的 OpenSSH 和 Unison 版本,并按照描述创建了 sync.bat。

不幸的是,Unison 崩溃并显示以下错误消息:

Uncaught exception Failure("input_value: bad bigarray kind")
Raised by primitive operation at file "./remote.ml", line 453, characters 18-45
Called from file "./remote.ml", line 459, characters 23-61
Called from file "./lwt/lwt.ml", line 75, characters 20-23
Re-raised at file "./lwt/lwt.ml", line 135, characters 12-13
Called from file "list.ml", line 73, characters 12-15
Called from file "./lwt/lwt.ml", line 31, characters 2-37
Called from file "./lwt/lwt.ml", line 83, characters 17-46
Called from file "./lwt/win/lwt_unix_impl.ml", line 239, characters 6-40
Called from file "./uitext.ml", line 490, characters 2-113
Called from file "./uitext.ml", line 556, characters 38-66
Called from file "./uitext.ml", line 718, characters 6-47
Called from file "./uitext.ml", line 756, characters 6-125
Called from file "./uitext.ml", line 804, characters 8-47
Called from file "./uitext.ml", line 870, characters 21-43

它确实可以正常工作:

  1. 第一次统一用于docker图像
  2. 当与标志 -ignorarchives 一起使用时

看了好几篇文章,大部分得出的结论是这是一个OCaml不兼容的问题。

如何解决这个问题? 其他人也遇到过该错误吗?

错误消息 "input_value: bad bigarray kind" 表示您在 Unison 中遇到了一个 well-known 错误。

不仅同步中涉及的两个 Unison 进程的主要版本需要匹配(您可能知道),在 OCaml 版本 4.01 和 4.02 之间的某处 OCaml 库中也有一个内部变化,与数据编组。很难给你一个精确的 link,因为一些 Google 最有希望的结果 return 是一个空白页,但我希望这些可以:

https://github.com/bcpierce00/unison/issues/32 http://unison-users.yahoogroups.narkive.com/7FOa6VCg/re-unison-failed-uncaught-exception-failure-input-value-bad-bigarray-kind

特别注意最后一页link:

[...] this is a known issue, and happens because Unison wasn't compiled against the same OCaml versions [...]. The marshaling in OCaml 4.01 and 4.02 uses a different format... You will have to compile Unison 2.48.3 against the same versions of OCaml [...]

我自己有时 运行 会遇到这个问题,我通过编译自己的 OCaml、Lablgtk for the graphical (GTK) interface 和 Unison 来规避它。我发现在 Linux 下编译它们非常简单(没有在其他操作系统上尝试过)。

最后我能够同步并运行以下设置:

  • 在 Windows 10 上:使用 unison-files provided by mgt-commerce.com - 它是版本 2.48.3(但我不知道使用的 OCaml 版本)
  • 在 docker 图像中使用 unison-sources 2.48.4 和 OCaml 版本 4.01.0 重新编译 unison

为此在 Dockerfile 中使用的命令:

RUN apt-get update && apt-get install -y \
    ocaml \
    && curl -L https://github.com/bcpierce00/unison/archive/2.48.4.tar.gz | tar zxv -C /tmp && \
         cd /tmp/unison-2.48.4 && \
         sed -i -e 's/GLIBC_SUPPORT_INOTIFY 0/GLIBC_SUPPORT_INOTIFY 1/' src/fsmonitor/linux/inotify_stubs.c && \
         make && \
         cp src/unison src/unison-fsmonitor /usr/bin && \
         cd /root && rm -rf /tmp/unison-2.48.4