caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Strange compilation error.
@ 2012-06-19 14:30 Philippe Veber
  2012-06-19 14:42 ` Maxence Guesdon
  0 siblings, 1 reply; 6+ messages in thread
From: Philippe Veber @ 2012-06-19 14:30 UTC (permalink / raw)
  To: caml users

[-- Attachment #1: Type: text/plain, Size: 2172 bytes --]

Dear camlers,

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

I'm missing something obvious, but I can't see what. Does it remind someone
of something?

Cheers,
  Philippe.

PS There should be nothing fancy in my installation:

$ which ocaml
/home/pveber/usr/ocamlbrew/ocaml-3.12.1/bin/ocaml
$ which ocamlc
/home/pveber/usr/ocamlbrew/ocaml-3.12.1/bin/ocamlc
$ head -n 1 /home/pveber/usr/ocamlbrew/ocaml-3.12.1/bin/ocaml
#!/home/pveber/usr/ocamlbrew/ocaml-3.12.1/bin/ocamlrun

PS2 I have no compilation problem with other modules/libraries, as shown by
the following session. I encounter (and solve) all usual compilation
errors, the way I'm used to.

$ cat test.ml
let _ = R.init
$ ocamlc -o test  test.ml
File "rmath.ml", line 1, characters 8-14:
Error: Unbound module R
$ ocamlc -o rmath -I
/home/pveber/usr/ocamlbrew/ocaml-3.12.1/lib/ocaml/site-lib/R rmath.ml
File "rmath.ml", line 1, characters 0-1:
Error: Error while linking rmath.cmo:
Reference to undefined global `R'
$ ocamlc -o rmath -I
/home/pveber/usr/ocamlbrew/ocaml-3.12.1/lib/ocaml/site-lib/R R.cma rmath.ml
File "rmath.ml", line 1, characters 0-1:
Error: Error while linking
/home/pveber/usr/ocamlbrew/ocaml-3.12.1/lib/ocaml/site-lib/R/R.cma(Initialisation):
Reference to undefined global `Unix'
$ ocamlc -o rmath -I
/home/pveber/usr/ocamlbrew/ocaml-3.12.1/lib/ocaml/site-lib/R unix.cma R.cma
rmath.ml
$./rmath [...]

[-- Attachment #2: Type: text/html, Size: 6065 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: [Caml-list] Strange compilation error.
@ 2012-06-19 15:10 Maxence Guesdon
  0 siblings, 0 replies; 6+ messages in thread
From: Maxence Guesdon @ 2012-06-19 15:10 UTC (permalink / raw)
  To: Philippe Veber; +Cc: caml users

[-- Attachment #1: Type: text/plain, Size: 1312 bytes --]

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 ?

Regards,

Maxence

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-06-19 16:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-19 14:30 [Caml-list] Strange compilation error Philippe Veber
2012-06-19 14:42 ` Maxence Guesdon
2012-06-19 14:47   ` Philippe Veber
2012-06-19 14:55     ` Maxence Guesdon
2012-06-19 16:28       ` Philippe Veber
2012-06-19 15:10 Maxence Guesdon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).