ocaml命令行找不到“topfind”

我安装了顶级,并设置了$OCAML_TOPLEVEL_PATH.

export OCAML_TOPLEVEL_PATH=/Users/smcho/.opam/system/lib/toplevel

我检查了该目录是否存在,并且有一个文件topfind.

这是我的〜/ .ocamlinit文件内容.

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

问题是我有错误消息说它无法找到topfind.

> ocaml
        OCaml version 4.02.1

Cannot find file topfind.
Unknown directive `camlp4o'.
# 

使用“ustop”,我没有错误消息.

可能有什么问题?

这是我的ocaml环境设置.

> opam config env
CAML_LD_LIBRARY_PATH="/Users/smcho/.opam/system/lib/stublibs:/usr/local/lib/ocaml/stublibs"; export CAML_LD_LIBRARY_PATH;
OPAMUTF8MSGS="1"; export OPAMUTF8MSGS;
MANPATH=":/Users/smcho/.opam/system/man"; export MANPATH;
MAKELEVEL=""; export MAKELEVEL;
MAKEFLAGS=""; export MAKEFLAGS;
PERL5LIB="/Users/smcho/.opam/system/lib/perl5:"; export PERL5LIB;
OCAML_TOPLEVEL_PATH="/Users/smcho/.opam/system/lib/toplevel"; export OCAML_TOPLEVEL_PATH;
PATH="..."; export PATH;

最佳答案 如samoth所述
here

Normally this issue does not exist anymore if you are not using the
system compiler. If you are using the system compiler, you can modify
you ~/.ocamlinit to load $OCAML_TOPLEVEL_PATH as done in
07001

因此,您可以使用其他开关或修改.ocamlinit.

点赞