I've been using oasis
to build my project using some external packages. Now I also want to use Jane Street's Core package. However, in order to compile with Core, you have to pass the -thread
flag to ocamlfind
, e.g. like this:
ocamlfind ocamlc -linkpkg -thread -package core foo.ml -o foo
How can I tell oasis
to add the -thread
flag? Right now, my _oasis file includes something like the following:
Executable "foo"
BuildDepends: core,batteries,bar
Path: src
MainIs: foo.ml
CompiledObject: best
Bar a collection of my own utilities from the same project. When I run oasis setup
and make
, I get this error:
ocamlfind: Error from package `threads': Missing -thread or -vmthread switch
I looked at the Oasis manual, and neither the common fields for all sections of the _oasis file, nor the fields that are specific to the Excutable section seem to be appropriate for adding a command line flag for ocamlfind
.
I thought that this answer might be relevant, but when I tried adding the extra keys it suggested, with -thread
as the value for XOCamlbuildExtraArgs
, I got an error:
E: Field XOCamlbuildExtraArgs is not defined in schema Executable
You need to add the following line to your _tags file:
<**/*>: thread
There will be a bunch of stuff between the OASIS_START
and OASIS_STOP
delimiters, don't add anything between them, but rather before or after.