问题描述
我安装了OCAML和OPAM,然后使用OPAM安装了诸如ocaml-http之类的库.当我尝试打开模块Http_types时,ocaml顶级抛出了错误的无界模块.
I installed OCAML and OPAM, then I installed libraries such as ocaml-http using OPAM. When I tried to open module Http_types, ocaml toplevel is throwing error unbounded module.
我尝试在/home/ubuntu/.opam/opam-init/variables.sh
在opam初始化过程中生成的旧文件:
old one generated during opam init:
CAML_LD_LIBRARY_PATH =/home/ubuntu/.opam/4.01.0/lib/stublibs;导出CAML_LD_LIBRARY_PATH;PERL5LIB =/home/ubuntu/.opam/4.01.0/lib/perl5:$ PERL5LIB;出口PERL5LIB;OCAML_TOPLEVEL_PATH =/home/ubuntu/.opam/4.01.0/lib/toplevel;导出OCAML_TOPLEVEL_PATH;MANPATH = $ MANPATH:/home/ubuntu/.opam/4.01.0/man;导出MANPATH;PATH =/home/ubuntu/.opam/4.01.0/bin:$ PATH;导出PATH;
CAML_LD_LIBRARY_PATH=/home/ubuntu/.opam/4.01.0/lib/stublibs; export CAML_LD_LIBRARY_PATH;PERL5LIB=/home/ubuntu/.opam/4.01.0/lib/perl5:$PERL5LIB; export PERL5LIB;OCAML_TOPLEVEL_PATH=/home/ubuntu/.opam/4.01.0/lib/toplevel; export OCAML_TOPLEVEL_PATH;MANPATH=$MANPATH:/home/ubuntu/.opam/4.01.0/man; export MANPATH;PATH=/home/ubuntu/.opam/4.01.0/bin:$PATH; export PATH;
我添加了CAML_LD_LIBRARY_PATH =/home/ubuntu/.opam/4.01.0/lib/stublibs:/home/ubuntu/.opam/4.01.0/lib;导出CAML_LD_LIBRARY_PATH;
I added CAML_LD_LIBRARY_PATH=/home/ubuntu/.opam/4.01.0/lib/stublibs:/home/ubuntu/.opam/4.01.0/lib; export CAML_LD_LIBRARY_PATH;
/home/ubuntu/.opam/4.01.0/lib是所有新的非标准库的安装位置.但是当我再次进行初始化时,新添加的行将消失.
/home/ubuntu/.opam/4.01.0/lib is where all the new non-standard libraries are installed. But when i do opam init again newly added line will disappear.
推荐答案
您需要使用#require
指令加载该库,类似这样的方法应该起作用:
You need to load this library with a #require
directive, something like this should work:
#use "topfind";;
#require "ocaml-http";;
别忘了实际键入此#
符号.
Do not forget to actually type this #
symbol.
这篇关于ocaml toplevel引发错误无界模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!