我已经安装opam
、运行opam init
、运行,它在里面opam switch 4.06.0
创建了一个4.06.0
目录~/.opam
,运行“eval opam confing env
”,其中包括导出,$OCAML_TOPLEVEL_PATH
当~/.opam/4.06.0/lib/toplevel
启动时ocaml
我得到了可怕的:
$ ocaml
OCaml version 4.06.0
Cannot find file topfind.
Unknown directive `camlp4o'.
#
我已经看过这个和这两个都没有解决我的问题而且我束手无策(第一次设置 OCaml)。这是我的~/.ocamlinit
:
(* Added by OPAM. *)
let () =
try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")
with Not_found -> ()
;;
#use "topfind"
#camlp4o
#thread
#require "core.top"
#require "core.syntax"
编辑:看起来我还没有安装core
,安装core
解决了这个问题,但现在在我得到的大量导入诊断中:
Exception:
Invalid_argument
"The ocamltoplevel.cma library from compiler-libs cannot be loaded inside the OCaml toplevel".
然后再往下一点:
Raised at file "pervasives.ml", line 33, characters 25-45
Called from file "toplevel/toploop.ml", line 468, characters 4-128
Called from file "toplevel/topdirs.ml", line 144, characters 10-51
Camlp4 Parsing version 4.06.0