[英]How to link OCaml object file with Core module?
I have simple program, which uses function from Core.Std
module, eg: 我有简单的程序,它使用Core.Std
模块的功能,例如:
open Core.Std
let _ = List.last [1;2;3]
I can compile and link it by ocamlfind
or ocamlbuild
: 我可以通过ocamlfind
或ocamlbuild
编译和链接它:
ocamlfind ocamlc -package core -linkpkg -thread app.ml
ocamlbuild -use-ocamlfind -pkgs core -tag thread app.native
But I don't know how to compile and link such file using "normal" OCaml compiler: 但我不知道如何使用“普通”OCaml编译器编译和链接此类文件:
ocamlc -c -I ~/.opam/system/lib/core_kernel/ -I ~/.opam/system/lib/core/ app.ml
ocamlc ~/.opam/system/lib/core_kernel/core_kernel.cma ~/.opam/system/lib/core/core.cma app.cmo
Last of above commands gives the following error: 上述命令的最后一行给出以下错误:
File "_none_", line 1:
Error: Error on dynamically loaded library: /home/maciej/.opam/system/lib/stublibs/dllcore_kernel_stubs.so: /home/maciej/.opam/system/lib/stublibs/dllcore_kernel_stubs.so: undefined symbol: caml_ba_alloc
What am I doing wrong? 我究竟做错了什么?
You can use ocamlfind ocamlc -only-show …
to see the full command constructed by ocamlfind . 你可以使用ocamlfind ocamlc -only-show …
来查看ocamlfind构造的完整命令。 Your error points towards some missing transitive dependencies of Core and an old version of OCaml and Core. 您的错误指向了Core和旧版OCaml和Core的一些缺失的传递依赖性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.