Telling ocamlbuild to use Core

1.4k views Asked by At

In my project I have a file that uses Core.Std stuff, so I have run

opam install core

and added

open Core.Std

in my file.

When I run

ocamlbuild myprogram.native

it says:

Error: Unbound module Core

pointing to line with the open statement above.

So, I try this:

ocamlbuild -use-ocamlfind -pkgs core.std myprogram.native

and get the following message:

ocamlfind: Package `core.std' not found

So I thought that maybe I needed to run opam install core.std as well, but apparently there is no such thing according to opam. I also tried "open Core.Std;;" in the ocaml repl, but that did not work either. Any ideas?

2

There are 2 answers

5
ivg On BEST ANSWER

You can either use corebuild which is usually shipped with this library or, you can try this:

 ocamlbuild -use-ocamlfind -pkg core

P.S. use ocamlfind list command to view the list of available packages.

P.P.S. In addition to corebuild they usually ship coretop, a script that allows you to run core-enabled top-level. It uses utop underneath the hood, so make sure that you have installed it with opam install utop (if you're using opam), before your experiments.

2
Jackson Tale On

Remove .std from your ocamlbuild cmd?