我正在使用Jane Street
的async_core
,方法是在_tags
中添加package(async_core)
。
当我使用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 -package/test_airport.cmx -o测试/test_airport.native ocamlfind:来自程序包‘-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
但是错误仍然是一样的。而且,在没有-thread
的情况下,ocamlbuild生成的实际命令也是一样的。
我该如何处理这件事?
发布于 2013-05-15 05:30:46
您想知道的是,是否有一个ocamlbuild标记(~ feature)可以将-thread
参数添加到相关的命令行中,而不是使用-cflag
以不令人满意的方式修改它。正如in this blog post所解释的,您应该使用ocamlbuild的-documentation
选项:
% 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调用行,或者只是在_tags
中的相关位置添加thread
。
https://stackoverflow.com/questions/16552834
复制相似问题