ocaml电池编译:错误:剩余的OCaml编译文件:

时间:2012-11-22 08:49:35

标签: ocaml ocaml-batteries

Build mode: shared
ocamlbuild -no-links syntax.otarget byte.otarget src/batteries_help.cmo META shared.otarget
Finished, 0 targets (0 cached) in 00:00:00.
SANITIZE: a total of 3 files that should probably not be in your source tree
  has been found. A script shell file
  "/home/fanzhihang/batteries-1.4.1/_build/sanitize.sh" is being created.
  Check this script and run it to remove unwanted files or use other options
  (such as defining hygiene exceptions or using the -no-hygiene option).
Warning: Leftover OCaml type annotation files:
  File pa_estring_top.annot in libs/estring has suffix .annot
IMPORTANT: I cannot work with leftover compiled files.
ERROR: Leftover OCaml compilation files:
  File pa_estring_top.cmo in libs/estring has suffix .cmo
  File pa_estring_top.cmi in libs/estring has suffix .cmi
Exiting due to hygiene violations.
Compilation unsuccessful after building 0 targets (0 cached) in 00:00:02.
make: *** [all] Error 1

这种电池编译错误确实让我很困惑。我该如何修复错误?

2 个答案:

答案 0 :(得分:1)

您知道OPAM吗?

$ opam install batteries

它将自动安装所有依赖项。

<强> [编辑] 如何安装opam:

$ git clone https://github.com/OCamlPro/opam
$ ./configure # (or ./configure --prefix=$HOME if you want to install under your $HOME)
$ make
$ make install
$ opam init
$ eval `opam config -env`

答案 1 :(得分:0)

您可以执行脚本:

/home/fanzhihang/batteries-1.4.1/_build/sanitize.sh

这将删除OCamlbuild认为不应该在这里的文件(即错误正在讨论的.annot,.cmo和.cmi)。