How can ocamldebug be used with the "Batteries included" project?

I have a simple ocamlbuild project that uses Batteries, including syntax extensions.

_tags :

 <*>: pkg_batteries,pkg_threads,pkg_batteries.syntax,syntax_camlp4o 

something.ml :

 open Batteries … let () = … 

It is built for debugging with:

 $ ocamlbuild something.d.byte $ ocamldebug something.d.byte 

Trying to use the print command in ocamldebug , however, gives the following error:

 (ocd) print x Cannot find module Batteries. 

This only happens when debugging in the area where Batteries open ed.

What is the reason for this error? How can I get along?

+7
source share
1 answer

You must make the batteries available to the debugger; dir command and -I command line options activate this. Unfortunately, this is more complicated than it should be, because ocamlfind does not support ocamldebug . But you can do it:

 $ ocamldebug `ocamlfind query -recursive -i-format batteries` -I _build something.d.byte 

This will pass the ocamldebug sequence of ocamldebug options to provide included paths for finding the appropriate modules.

+8
source

All Articles