ocaml 命令行找不到 "topfind"

ocaml command line cannot not find "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 https://github.com/OCamlPro/opam/blob/master/shell/dot_ocamlinit

因此您可以使用不同的开关或修改您的 .ocamlinit