2012/6/19 Maxence Guesdon <Maxence.Guesdon@inria.fr>
On Tue, 19 Jun 2012 16:47:16 +0200
Philippe Veber <philippe.veber@gmail.com> wrote:

> 2012/6/19 Maxence Guesdon <Maxence.Guesdon@inria.fr>
>
> > On Tue, 19 Jun 2012 16:30:27 +0200
> > Philippe Veber <philippe.veber@gmail.com> wrote:
> >
> > > Dear camlers,
> >
> > Hello,
> >
> > > I'm desperately stuck with the following issue: I fail to compile a
> > program
> > > using a module, but have no problem using the module in question in the
> > > toplevel.
> > >
> > > Here is how I use it in the toplevel
> > >
> > > $ ocaml
> > >         Objective Caml version 3.12.1
> > >
> > > # #directory
> > > "/home/pveber/usr/ocamlbrew/ocaml-3.12.1/lib/ocaml/site-lib/R";;
> > > # #load "/home/pveber/usr/ocamlbrew/ocaml-3.12.1/lib/ocaml/site-lib/R/
> > > R_math.cma";;
> > > # Rmath.pow;;
> > > - : float -> float -> float = <fun>
> > >
> > >
> > > Now with the following program:
> > > $ cat test.ml
> > > let x = Rmath.pow 2.
> > >
> > > I try to compile with the options corresponding to the toplevel
> > directives:
> > >
> > > $ ocamlc -o rmath -I
> > > /home/pveber/usr/ocamlbrew/ocaml-3.12.1/lib/ocaml/site-lib/R
> > > /home/pveber/usr/ocamlbrew/ocaml-3.12.1/lib/ocaml/site-lib/R/R_math.cma
> > > test.ml
> > > File "test.ml", line 1, characters 8-17:
> > > Error: Unbound module Rmath
> >
> > Do you have a R_math.cmi file in your ...site-lib/R directory ?
> >
>
> Hi Maxence,
>
> I have a rmath.cmi, and Rmath is one of the modules contained in R_math.cma
> That should be ok, right?

Ah yes, sorry. Then I have no idea.

You couldn't have guessed, that one was really really really silly: before calling my test program test.ml, I called it rmath.ml. After I changed it, but there still was a rmath.cmi in my current directory, which would hide the one in site-lib/R.

Really sorry for the noise, and thanks Maxence for giving a hand!
ph.