I am using Jane Street
's async_core
by adding package(async_core)
in _tags
.
When I use ocamlbuild -use-ocamlfind -I src test/test_airport.native
, it gives me the 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 from package `threads': Missing -thread or -vmthread switch
I googled it and here is what I got http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual039.html
It says:
Programs that use system threads must be linked as follows:
ocamlc -thread other options unix.cma threads.cma other files
So I changed my ocamlbuild command like this:
ocamlbuild -use-ocamlfind -cflag -thread -I src test/test_airport.native
But the error remains the same. also the actual command that ocamlbuild generated remains the same without -thread
.
How can I deal with this?
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:So the answer is: add
-tag thread
to your ocamlbuild invocation line, or justthread
in the relevant place in_tags
.