0
votes

I have installed a few packages using opam, such as Core and Batteries. The ocamlinit file is as follows:

(* Added by OPAM. *)

#use "topfind"
#thread
#camlp4o
#require "core.top"
#require "core.syntax"
#require "batteries"

let () =
  try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")
  with Not_found -> ()
;;

When I run this with utop I can see the modules for Batteries but I cannot see any of the modules for Core. When I try to do open Core or open Core.Std I get an unbound module error. I also tried adding in #require "core" and the error persisted.

I'm not sure what the error is since I followed the installation instructions from the book "Real World OCaml".

I also see two messages when I start off utop:

No such package: oUnit" - required by `pa_ounit'"
No such package: pa_pipebang" - required by `core.syntax'"

I'm not sure if these are related to the problem but when I do opam list ounit and opam list pipebang it shows them as installed.

1
Have you tried putting that let () = try Topdirs.... code at the top of the file, before the #use "topfind"Edgar Aroutiounian
Just tried and sadly it didn't make a difference.Journey Coder

1 Answers

0
votes

Ok, I made a fresh install of OCaml and I found out that the problem is indeed related to

No such package: oUnit" - required by `pa_ounit'"
No such package: pa_pipebang" - required by `core.syntax'"

What happened was when I tried to opam install yojson async an error occurred. From that point onward Core didn't load properly.

So I suppose something is wrong with the installation instructions on 'Real World OCaml' for the additional libraries.