1

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
4

1 回答 1

4

您需要将以下行添加到您的 _tags 文件中:

<**/*>: thread

OASIS_START和分隔符之间会有一堆东西OASIS_STOP,不要在它们之间添加任何东西,而是在之前或之后。

于 2017-06-19T17:45:16.920 回答