I have created my ~/.ocamlinit
as follows
let interactive = !Sys.interactive;;
Sys.interactive := false;; (*Pretend to be in non-interactive mode*)
#use "topfind";;
Sys.interactive := interactive;; (*Return to regular interactive mode*)
Toploop.use_silently Format.err_formatter (Filename.concat (Findlib.package_directory "batteries") "battop.ml");;
When I type ocaml
at command line, I get the following error:
$ ocaml
Objective Caml version 3.12.1
Cannot find file topfind.
File ".ocamlinit", line 6, characters 60-85:
Error: Unbound module Findlib
#
What is causing this issue and how should I go about for fixing this issue?
(I am on Debian Wheezy)
Edit: I have set an alias for ocaml:
alias ocaml='rlwrap -H /home/nanda/.ocaml_history -D 2 -i -s 10000 ocaml'
With due thanks to
dkim
, I would post the solution that worked for me. Hope this helps someone else.Ocaml Batteries Installation Process
To be able to work with the ocaml-batteries-included, I followed this process:
rlwrap
orledit
is needed to add readline support for OCaml toploop.Added an alias in
.bashrc
, to save the commands entered in the ocaml toploop.-H specifies history file name
-D ignores duplicates
-i case insensitive
-s limits the number of commands stored in this file
As mentioned in the comments, I was receiving this error when trying to invoke the ocaml interpreter.
I received this error because ocaml-findlib package was not properly installed. I have mamaged to solve this by installing the
libfindlib-ocaml-dev
package:For some people, the issue is solved when findlib package is installed from sources as mentioned here
Some more helpful links: