2012-09-11 98 views
2

我正在尝试使用Ocaml csv库。我下载csv-1.2.3跟着安装findlib后的安装说明:在共享服务器上安装Ocaml驼峰库

  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'

现在我有METAcsv.acsv.cmacsv.cmicsv.cmxcsv.cmxacsv.mli文件~/opt/lib/ocaml/site-lib/csv剧目。 shell命令ocamlfind list -describe给出了csv A pure OCaml library to read and write CSV files. (version: 1.2.3),我相信这意味着csv已正确安装。

,但是当我在compute.ml模块添加

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

,并尝试在更大的程序包我的编译错误中编译:

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 

我收到:

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

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

+1

显示编译命令行 – ygrek

+0

是“制造”和Makefile是相当大的,因为它是一个大的程序(约50个文件.ml) – user1659958

回答

1

我的猜测是你正在使用ocamlfind进行编译(ocamlfind ocamlc -package csv ...),因为你有一个链接错误,而不是类型检查(如果你没有指定csv的位置,就是这种情况)。在这种情况下,解决方案可能会将​​3210选项添加到生成可执行文件的最终编译行中,要求它将csv.cmx与其链接。否则,请尝试使用ocamlfind,是的,请告诉我们您的编译命令是什么。

对于顶层,它很容易使用ocamlfind它。观看这种最前沿的互动:

% 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> 

要明确。我在顶层键入曾经是:

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

感谢为:的CSV在顶层工作良好。仍然我无法编译我的程序包,我用以下代码修改了模块compute.ml'let data = Csv.load“foo.csv”in'错误的编译命令(即使在最后使用-linkall)也是'ocamlopt。 opt -warn-error A unix.cmxa argl.cmx lock.cmx def.cmx buff.cmx mut.cmx secure.cmx bbar.cmx ute.cmx utd.cmx base.cmx check.cmx compute.cmx mx sassyz.cmx db1link .cmx sassu.cmx -cclib -lunix -o sassy.opt -linkall'给出消息“Error:No implementation provided for the following modules:Csv referenced from compute.cmx” – user1659958

+2

尝试'ocamlfind ocamlopt.opt -package csv - linkall -warn-error一个unix.cmxa argl.cmx ... -o sassy.opt'。如果幸运的话,'ocamlbuild -use-ocamlfind -pkg csv sassyz.native'也可能起作用。 – gasche

+0

它看起来我的相互服务器上有一个错误的库安装:我得到了错误消息:findlib:[警告]接口csv.cmi发生在几个目录中:。,/ xxx/zzz/sss/htdocs/opt/lib/ocaml/site-lib/csv findlib:[WARNING] Interface num。cmi出现在几个目录中:/ xxx/zzz/sss/htdocs/opt/lib/ocaml,。 文件“_none_”,行1,字符0-1: 错误:未为以下模块提供实现: Csv引用自compute.cmx – user1659958