ocaml - How to use -thread compiler flag with ocamlbuild? -


i using jane street's async_core adding package(async_core) in _tags.

when use ocamlbuild -use-ocamlfind -i src test/test_airport.native, gives me following error:

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: error package `threads': missing -thread or -vmthread switch


i googled , here got http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual039.html

it says:

programs use system threads must linked follows:

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

so changed ocamlbuild command this:

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

but error remains same. actual command ocamlbuild generated remains same without -thread.


how can deal this?

what want know whether there ocamlbuild tag (~ feature) add -thread argument relevant command-lines, instead of hacking -cflag in unsatisfying ways. explained in blog post, should use -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 answer is: add -tag thread ocamlbuild invocation line, or thread in relevant place in _tags.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -