简体   繁体   中英

OCaml: Unbound module Core with ~/.ocamlinit setup

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM