Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Batteries in .mly file with ocamlbuild

I have a project with OCaml .ml files and a Menhir .mly file. I use ocamlbuild to compile the project.

My _tags file contains this single line:

true: use_menhir, package(batteries)

Everything works well, except when I want to use Batteries in the .mly file. If I open Batteries ;; between %{ and %} in my .mly file, I get "Error: Unbound module Batteries" when calling ocamlbuild.

It seems that when ocamlbuild is calling menhir, like this:

/usr/bin/menhir --ocamlc '/usr/bin/ocamlfind ocamlc' --infer parser.mly

it forgets to add -package batteries (or something equivalent) in the --ocamlc option of menhir.

How can I fix that? Maybe a special rule for my .mly file in my _tags file could help? Or is it a ocamlbuild bug?

like image 392
p4bl0 Avatar asked Dec 25 '22 22:12

p4bl0


1 Answers

This is supposedly fixed in recent OCaml versions (see http://caml.inria.fr/mantis/view.php?id=5763). Which version are you running?

like image 161
Jonathan Protzenko Avatar answered Jan 18 '23 02:01

Jonathan Protzenko