本文介绍了如何在ocamlbuild中使用-thread编译器标志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过在_tags中添加package(async_core)来使用Jane Streetasync_core.

I am using Jane Street's async_core by adding package(async_core) in _tags.

当我使用ocamlbuild -use-ocamlfind -I src test/test_airport.native时,会出现以下错误:

When I use ocamlbuild -use-ocamlfind -I src test/test_airport.native, it gives me the following error:


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

它说:

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

所以我这样更改了ocamlbuild命令:

So I changed my ocamlbuild command like this:

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

但是错误仍然相同.不用-thread,ocamlbuild生成的实际命令也将保持不变.

But the error remains the same. also the actual command that ocamlbuild generated remains the same without -thread.

我该如何处理?

推荐答案

您想知道的是是否存在ocamlbuild标记(〜功能),将-thread参数添加到相关的命令行中,而不是进行黑客攻击-cflag以不令人满意的方式显示它.如此博客文章中所述,您应该使用ocamlbuild的-documentation选项:

What you want to know is whether there is an ocamlbuild tag (~ feature) to add the -thread argument to the relevant command-lines, instead of hacking it with -cflag in unsatisfying ways. As explained in this blog post, you should use the -documentation option of 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"

所以答案是:在您的ocamlbuild调用中添加-tag thread行,或者只是在_tags中相关位置的thread.

So the answer is: add -tag thread to your ocamlbuild invocationline, or just thread in the relevant place in _tags.

这篇关于如何在ocamlbuild中使用-thread编译器标志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 21:32