ocamlocamlbuildmirage

ocamlopt and ocamlbuild give an Unbound module error despite ocamlfind seeing the required module


I'm attempting to build the xencat tool from this project. When I try to use ocamlopt to build it, I get

$ ocamlopt -o xencat xencat.ml 
File "xencat.ml", line 1, characters 5-13:
Error: Unbound module Cmdliner

Following guidance here, I verified that cmdliner was installed and that it was visible to ocamlfind, and then tried again:

Here's what ocamlfind list shows:

$ ocamlfind list
bigarray            (version: [distributed with Ocaml])
bytes               (version: [distributed with OCaml 4.02 or above])
...
cmdliner            (version: 0.9.8)
...

No luck:

$ ocamlfind ocamlopt -o xencat xencat.ml
File "xencat.ml", line 1, characters 5-13:
Error: Unbound module Cmdliner

Following this page, I tried ocamlbuild:

$ocamlbuild -use-ocamlfind xencat.byte
+ ocamlfind ocamlc -c -o xencat.cmo xencat.ml
File "xencat.ml", line 1, characters 5-13:
Error: Unbound module Cmdliner
Command exited with code 2.

Clearly I'm missing something, but being new to Ocaml, I don't know what else to try.


Solution

  • ocamlbuild -use-ocamlfind -package cmdliner xencat.byte

    ?