Using oasis, I add <**/*>: thread
to the end of my _tags file, because otherwise I get this error:
ocamlfind: Error from package
threads’: Missing -thread or -vmthread switch`
I know that I need threads because I use Core.Command
and Core.Command.Spec
in one file, but I don’t know anything about the threads
package, why it’s used by Command
, etc. (That hasn’t been important to me so far; it hasn’t seemed necessary to learn more.)
I just installed a new OCaml 4.05.0 switch, and now I’m getting this mysterious error:
ocaml setup.ml -build
Finished, 0 targets (0 cached) in 00:00:00.
+ /Users/marshall/.opam/4.05.0/bin/ocamlfind ocamlopt -g -thread threads.cmxa -linkpkg -package batteries -package core -package owl -I src src/probutils.cmxa src/wrightfisherPDFs.cmx -o src/wrightfisherPDFs.native
File "_none_", line 1:
Error: Files /Users/marshall/.opam/4.05.0/lib/ocaml/threads/threads.cmxa
and /Users/marshall/.opam/4.05.0/lib/ocaml/threads/threads.cmxa
both define a module named Thread
Any suggestions about how to fix this or what I should look for in order to figure out what’s going on? (Or: What other information should I report here?)
I noticed that myocamlbuild.ml contains this block, which seems relevant, but I don’t understand it:
(* The default "thread" tag is not compatible with ocamlfind.
* Indeed, the default rules add the "threads.cma" or "threads.cmxa"
* options when using this tag. When using the "-linkpkg" option with
* ocamlfind, this module will then be added twice on the command line.
*
* To solve this, one approach is to add the "-thread" option when using
* the "threads" package using the previous plugin.
*)
flag ["ocaml"; "pkg_threads"; "compile"] (S[A "-thread"]);
flag ["ocaml"; "pkg_threads"; "doc"] (S[A "-I"; A "+threads"]);
flag ["ocaml"; "pkg_threads"; "link"] (S[A "-thread"]);
flag ["ocaml"; "pkg_threads"; "infer_interface"] (S[A "-thread"]);
flag ["c"; "pkg_threads"; "compile"] (S[A "-thread"]);
flag ["ocaml"; "package(threads)"; "compile"] (S[A "-thread"]);
flag ["ocaml"; "package(threads)"; "doc"] (S[A "-I"; A "+threads"]);
flag ["ocaml"; "package(threads)"; "link"] (S[A "-thread"]);
flag ["ocaml"; "package(threads)"; "infer_interface"] (S[A "-thread"]);
flag ["c"; "package(threads)"; "compile"] (S[A "-thread"]);