-->

如何使用-thread编译器标志和ocamlbuild?(How to use -thread co

2019-09-03 05:05发布

我使用的Jane Streetasync_core加入package(async_core)_tags

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

camlfind ocamlopt -linkpkg -package async_core -package UNIX -package netclient -package蒙戈-package XML的光的src / airport.cmx测试/ test_airport.cmx -o测试/ test_airport.native ocamlfind:从包错误`线程:缺少-thread或-vmthread开关


我GOOGLE了它,这里是我得到了什么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


我该如何面对呢?

Answer 1:

你想知道的是,是否有一个ocamlbuild标签(〜功能)的添加-thread参数,而不是用黑客它相关的命令行, -cflag在不令人满意的方式。 正如解释在这篇博客文章 ,你应该使用-documentation ocamlbuild的选项:

% 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



文章来源: How to use -thread compiler flag with ocamlbuild?