ocamlocamlbuild

Unbound Module Stdlib


I am trying to build code using ocamlc however, I got error Error: Unbound module Stdlib

The /usr/lib/ocaml/ directory includes the following stdlib.a stdlib.cma stdlib.cxma stdlib.p.a stdlib.p.cxma

OCaml version : 4.05.0


Solution

  • The standard library was renamed from Pervasives to Stdlib fairly recently. Your compiler is from before the change; i.e., the 4.05.0 compiler has a Pervasives module and no Stdlib module. The code you're trying to compile is most likely from after the change.

    There's usually no reason to mention the name of the standard library because it is "pervasive". So you could try removing "Stdlib." wherever you see it. Or you could try renaming it to "Pervasives.".

    If the code is much more recent than the 4.05.0 compiler you could encounter other problems, however.