4

I'm trying to use the ocaml debugger to display variables at runtime from emacs. When I use the middle mouse button, as suggested by this guide my system just pastes from the clipboard. When I try to explicitly use the display command on a variable, I get

Cannot find module Core.Std

I have no problems with this when I compile using corebuild, so I know I have Core installed. Also, when I explicitly use the directory command to add the libraries for core and core_extended, it properly displays the variable. Is there some better way to make this work?

user3131124
  • 119
  • 5
  • How did you install Core? Via OPAM? Are the OCaml environment variables available in your Emacs? –  Jul 18 '14 at 09:57
  • Yes I did install via opam. And what do you mean by the ocaml environment variables? I have my config set up so that I can use tuareg, merlin, ocp-indent, etc. – user3131124 Jul 19 '14 at 06:10
  • `CAML_LD_LIBRARY_PATH` and `OCAML_TOPLEVEL_PATH` must be available in `process-environment` to make OPAM libraries available to ocaml when running from Emacs. –  Jul 19 '14 at 14:53
  • within process-environment, OCAML_TOPLEVEL_PATH=$HOME/.opam/4.01.0/lib/toplevel, and CAML_LD_LIBRARY_PATH=$HOME/.opam/4.01.0/lib/stublibs. Does that sound right? – user3131124 Jul 19 '14 at 16:39

1 Answers1

3

To print values ocamldebug needs to have the .cmi file containing the value's type in its search path. You can add directories to the search path using -I command-line arguments or the directory command.

Whilst ocamlfind doesn't seem to support ocamldebug directly, you can still use it to pass the correct -I arguments using the following command-line:

ocamldebug `ocamlfind query -recursive -i-format core` foo

where foo is the program being debugged.

Leo White
  • 1,131
  • 5
  • 9
  • 2
    if the fix is so simple, then why isn't it added already to ocamlfind. –  Jul 01 '15 at 02:22