3

I have had no problem installing any OCaml packages via opam in the past. However I am unable to install Cryptokit.

I am using the command:

    $ opam install cryptokit

and I recieve the following error messages (I am unsure what they mean and cannot find any documentation on the errors):

[ERROR] The compilation of cryptokit.1.9 failed.
Removing cryptokit.1.9.
  ocamlfind remove cryptokit


===== ERROR while installing cryptokit.1.9 =====
# opam-version 1.1.0
# os           linux
# command      make
# path         /home/alpha/.opam/system/build/cryptokit.1.9
# compiler     system (4.01.0)
# exit-code    2
# env-file     /home/alpha/.opam/system/build/cryptokit.1.9/cryptokit-9111-ffb3fd.env
# stdout-file  /home/alpha/.opam/system/build/cryptokit.1.9/cryptokit-9111-ffb3fd.out
# stderr-file  /home/alpha/.opam/system/build/cryptokit.1.9/cryptokit-9111-ffb3fd.err
### stdout ###
# ...[truncated]
# mv stubs-md5.o src/stubs-md5.o
# ocamlfind ocamlc -ccopt -O -ccopt -DHAVE_ZLIB -c src/stubs-misc.c
# mv stubs-misc.o src/stubs-misc.o
# ocamlfind ocamlc -ccopt -O -ccopt -DHAVE_ZLIB -c src/stubs-rng.c
# mv stubs-rng.o src/stubs-rng.o
# ocamlfind ocamlc -ccopt -O -ccopt -DHAVE_ZLIB -c src/stubs-zlib.c
# + ocamlfind ocamlc -ccopt -O -ccopt -DHAVE_ZLIB -c src/stubs-zlib.c
# src/stubs-zlib.c:19:18: fatal error: zlib.h: No such file or directory
# compilation terminated.
# Command exited with code 2.
### stderr ###
# E: Failure("Command ''/usr/bin/ocamlbuild' src/libcryptokit_stubs.a src/dllcryptokit_stubs.so src/cryptokit.cma src/cryptokit.cmxa src/cryptokit.a src/cryptokit.cmxs -tag debug -classic-display' terminated with error code 10")
# make: *** [build] Error 1

'opam install cryptokit' failed.
Thomas
  • 347
  • 3
  • 19

2 Answers2

6
# src/stubs-zlib.c:19:18: fatal error: zlib.h: No such file or directory

OPAM does not install non OCaml external libraries automatically. It is out of the scope of this tool. Cryptokit depends on several external libraries and zlib is one of them.

You must install zlib and its header files (and those of other libraries) by your distribution's package manager or by hand. In many distributions it should be provided by the name of zlib-dev or something similar.

camlspotter
  • 8,990
  • 23
  • 27
2

In Ubuntu:

sudo apt-get install zlib1g zlib1g-dev

[This should be a comment for the response above.]