How to use -thread compiler flag with ocamlbuild?

后端 未结 1 1618
难免孤独
难免孤独 2021-02-12 11:33

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

When I use ocamlbuild -use-ocamlf

相关标签:
1条回答
  • 2021-02-12 12:25

    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"
    

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

    0 讨论(0)
提交回复
热议问题