21

我通过添加来使用Jane Street's 。async_corepackage(async_core)_tags

当我使用ocamlbuild -use-ocamlfind -I src test/test_airport.native时,它给了我以下错误:

camlfind ocamlopt -linkpkg -package async_core -package unix -package netclient -package mongo -package xml-light src/airport.cmx test/test_airport.cmx -o test/test_airport.native ocamlfind: 来自包“threads”的错误:缺少-thread或 -vmthread 开关


我用谷歌搜索了它,这是我得到的http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual039.html

它说:

使用系统线程的程序必须按如下方式链接:

    ocamlc -thread other options unix.cma threads.cma other files

所以我像这样改变了我的 ocamlbuild 命令:

ocamlbuild -use-ocamlfind -cflag -thread -I src test/test_airport.native

但错误仍然是一样的。ocamlbuild 生成的实际命令也没有-thread.


我该如何处理?

4

1 回答 1

23

您想知道的是是否有一个 ocamlbuild 标记(~ 功能)来将-thread参数添加到相关的命令行,而不是以-cflag不满意的方式对其进行破解。如本博文所述,您应该使用-documentationocamlbuild 选项:

% ocamlbuild -documentation | grep thread
flag {. byte, link, ocaml, program, thread .} "threads.cma -thread"
flag {. link, native, ocaml, program, thread .} "threads.cmxa -thread"
flag {. doc, ocaml, thread .} "-I +threads"
flag {. compile, ocaml, thread .} "-thread"

所以答案是:添加-tag thread到您的 ocamlbuild 调用行,或者只是thread_tags.

于 2013-05-14T21:30:46.347 回答