0
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

This compiling error of batteries really puzzles me. How should I fix the error?

Canoe
  • 347
  • 1
  • 3
  • 11

2 Answers2

1

Do you know OPAM ?

$ opam install batteries

It will install all dependencies automatically.

[EDIT] How to install 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`
Çağdaş Bozman
  • 2,537
  • 16
  • 21
  • can I fix the installed path if I install batteries by it? I do not have the root authority. – Canoe Nov 22 '12 at 10:14
  • installed OPAM follow the tutorial here: http://opam.ocamlpro.com/doc/Quick_Install.html[link] ./opam64:/lib64/libc.so.6: version `GLIBC_2.7' not found (required by ./opam64)`code` – Canoe Nov 22 '12 at 10:24
  • You don't need to be root. Try to compile opam from source [here](https://github.com/OCamlPro/opam) and re-try `opam install batteries`. I'll edit my post for the opam install part. – Çağdaş Bozman Nov 22 '12 at 10:41
  • You should definitely use `./configure --prefix=$HOME` – Çağdaş Bozman Nov 22 '12 at 10:44
  • opam init Cannot download http://opam.ocamlpro.com/urls.txt, please check your connection settings. 'opam init' failed `code` How should I check my connection settings? – Canoe Nov 22 '12 at 10:55
  • Do you have `~/.opam` directory ? – Çağdaş Bozman Nov 22 '12 at 11:27
  • Check this [issue](https://github.com/OCamlPro/opam/issues/288), maybe it could help. – Çağdaş Bozman Nov 22 '12 at 11:39
  • the author said my curl version should be update. But I have try another tool software named godi which helps me install batteries successfully. Thanks a lot. Your PhD study is quite interesting:) – Canoe Nov 24 '12 at 07:38
0

You can execute the script:

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

This will delete the files that OCamlbuild thinks should not be here (namely the .annot, the .cmo and the .cmi the error is talking about).

Bardou
  • 446
  • 2
  • 2
  • it does work and it removes some files installed not correctly. But I do roll back to the problem:Unbound module Toploop. You can my question here:http://stackoverflow.com/questions/13506800/ocaml-batteries-compiling-unbound-module-toploop – Canoe Nov 22 '12 at 10:18