如何在ocamlbuild中使用-thread编译器标志?
我通过在如何在ocamlbuild中使用-thread编译器标志?,ocaml,ocamlbuild,Ocaml,Ocamlbuild,我通过在\u标签中添加package(async\u core)来使用Jane Street的async\u 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
\u标签中添加package(async\u core)
来使用Jane Street
的async\u 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
test/test_airport.cmx-o test/test_airport.native ocamlfind:错误
来自包“threads”:缺少-thread或-vmthread开关
我用谷歌搜索了一下,这是我得到的
它说:
使用系统线程的程序必须按如下方式链接:
ocamlc -thread other options unix.cma threads.cma other files
因此,我更改了ocamlbuild命令,如下所示:
ocamlbuild-使用ocamlfind-cflag-thread-I src test/test\u airport.native
但错误依然存在。此外,ocamlbuild生成的实际命令在没有-thread
的情况下保持不变
如何处理此问题?您想知道的是,是否有ocamlbuild标记(~feature)将-thread
参数添加到相关命令行,而不是以不满意的方式使用-cflag
对其进行攻击。如前所述,您应该使用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"
因此,答案是:向ocamlbuild调用添加-tagthread
行,或者只在\u tags
中的相关位置执行线程,在极不可能的情况下,gasche的答案不够清楚,这里有一个janestreet在他们的一次会谈中使用的_tags文件:谢谢。我想我还不明白这句话的意思ocamlbuild@JacksonTale换句话说,您必须在编译项目的目录中创建一个\u tags
文件ocamlbuild
将在\u标签
文件中搜索标志,并调用必要的命令,为您在\u标签
文件中指定的文件调用相应的标志。谁如此恨我以至于对我的每个问题都投否决票?