在交互式服务器上安装Ocaml hump库 [英] installing an Ocaml hump library on mutualized server

查看:184
本文介绍了在交互式服务器上安装Ocaml hump库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Ocaml csv库。我下载了 csv-1.2.3 并按照安装findlib后的安装说明进行操作:

I am trying to use the Ocaml csv library. I downloaded csv-1.2.3 and followed the installation instructions after installing findlib:



  1. 解压缩源归档文件并转到包的根目录

  2. 运行'ocaml

  3. 运行'ocaml setup.ml -install'
  4. 运行'ocaml setup.ml -build' li>
  1. Uncompress the source archive and go to the root of the package,
  2. Run 'ocaml setup.ml -configure',
  3. Run 'ocaml setup.ml -build',
  4. Run 'ocaml setup.ml -install'


现在我有 META csv.a csv.cma csv.cmi csv.cmx csv.cmxa csv.mli 〜/ opt / lib / ocaml / site-lib / csv repertory。 shell命令 ocamlfind list -describe 给出 csv一个纯OCaml库来读取和写入CSV文件。 (version:1.2.3),我相信这意味着csv已正确安装。

Now I have META, csv.a, csv.cma, csv.cmi, csv.cmx, csv.cmxa, csv.mli files in ~/opt/lib/ocaml/site-lib/csv repertory. The shell command ocamlfind list -describe gives csv A pure OCaml library to read and write CSV files. (version: 1.2.3) which I believe means that csv is installed properly.

但是当我添加

  let data = Csv.load "foo.csv" in

在我的 compute.ml 模块,并尝试在更大的程序包中编译我有编译错误:

in my compute.ml module and try to compile it within the larger program package I have the compilation error :

File "_none_", line 1, characters 0-1:
Error: No implementations provided for the following modules:
         Csv referenced from compute.cmx"

如果我只需键入

let data = load "foo.csv" in

i get:

File "compute.ml", line 74, characters 13-17:
Error: Unbound value load



当使用 Csv时,我有相同类型的错误。在Ocaml终端中直接加载加载有人会知道我的代码或库安装有什么问题吗?

I have the same type of errors when I use Csv.load or load directly in the Ocaml terminal. Would somebody have an idea of what is wrong in my code or library installation?

推荐答案

我的猜测是,你使用 ocamlfind 进行编译> ocamlfind ocamlc -package csv ... ),因为你有一个链接错误,而不是一个类型检查(如果你没有指定所有 csv is)。在这种情况下,解决方案可以向生成可执行文件的最终编译行中添加 -linkall 选项,要求它链接 csv。 cmx 。否则,请尝试使用 ocamlfind ,然后告诉我们您的编译命令。

My guess is that you're using ocamlfind for compilation (ocamlfind ocamlc -package csv ...), because you have a linking error, not a type-checking one (which would be the case if you had not specified at all where csv is). The solution may be, in this case, to add a -linkall option to the final compilation line producing an executable, to ask it to link csv.cmx with it. Otherwise, please try to use ocamlfind and yes, tell us what your compilation command is.

对于toplevel,它很容易使用 ocamlfind 从它。观看这个toplevel互动:

For the toplevel, it is very easy to use ocamlfind from it. Watch this toplevel interaction:

% ocaml
        Objective Caml version 3.12.1

# #use "topfind";;
- : unit = ()
Findlib has been successfully loaded. Additional directives:
  #require "package";;      to load a package
  #list;;                   to list the available packages
  #camlp4o;;                to load camlp4 (standard syntax)
  #camlp4r;;                to load camlp4 (revised syntax)
  #predicates "p,q,...";;   to set these predicates
  Topfind.reset();;         to force that packages will be reloaded
  #thread;;                 to enable threads

- : unit = ()
# #require "csv";;
/usr/lib/ocaml/csv: added to search path
/usr/lib/ocaml/csv/csv.cma: loaded
# Csv.load;;
- : ?separator:char -> ?excel_tricks:bool -> string -> Csv.t = <fun>

要明确。我在顶层输入的内容是:

To be explicit. What I typed once in the toplevel was:

#use "topfind";;
#require "csv";;
Csv.load;; (* or anything else that uses Csv *)

这篇关于在交互式服务器上安装Ocaml hump库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆