I am using docker to build an ubuntu binary. It has been working reasonably well. But recently I started using “Uuid” module from “Core”. With this, I get “Unbound module Uuid” error. Same code compiles on my laptop MacOSX. Any thoughts about what might be going wrong? Some additional details follow.
File "pervasives/utils.ml", line 95, characters 13-27:
95 | let uuid = Uuid.to_string (Uuid.create ()) in
Error: Unbound module Uuid
My Dockerfile looks like this
RUN opam switch 4.08
RUN eval $(opam env)
# RUN opam install -y core ocamlbuild.0.12.0 getopt menhir re2
RUN opam install -y core ocamlbuild ocamlnet getopt menhir re2
ADD build.sh .
Local (Mac OSX) settings
$ ocaml --version
The OCaml toplevel, version 4.07.1
$ opam --version
Are you using different versions of the
core library? Try
opam list to see what you have installed in both the Docker setup and the Mac one.
Looks like the same libraries but there are version differences, e.g.,
core on my mac: v0.11.3
core on docker: v0.12.2
Uuid is coming from Core as far as I know, so perhaps this is the reason.
Uuid got split out into a separate library between those versions of Core. You need to add
core.uuid to your
libraries field. Also, the module is now called
I am using ocamlbuild. Do I need to add a package to ocamlbuild?
(BTW, as Anil pointed out, it was a versioning issue indeed. when i pinned the core in the docker build to v11.0.3 it worked as expected.)
Yes, I think you can just add the
I am aware it’s a versioning issue. For core starting at version
v0.12.0, you’ll have to add the package explicitly to get the UUID library—this isn’t a workaround, it’s the intended behavior.