caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* ocamlbuild fails to link dependent module
@ 2008-06-30 21:37 Ashish Agarwal
  0 siblings, 0 replies; only message in thread
From: Ashish Agarwal @ 2008-06-30 21:37 UTC (permalink / raw)
  To: Caml List

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

I cannot get ocamlbuild to link properly under a very specific situation
that involves nested and packed modules. The following is a minimal example
that reproduces the problem.
$ cat a2.mli
val f : unit -> unit

$ cat a2.ml
let f _ = ()

$ cat lib.ml
module A = A2

$ cat b.ml
let g = Lib.A.f

$ cat sup.mlpack
B

$ cat prog.ml
let _ = Sup.B.g ()

Now try compiling:
$ ocamlbuild prog.byte
+ /Users/ashish/godi/bin/ocamlc.opt lib.cmo sup.cmo prog.cmo -o prog.byte
Error while linking lib.cmo: Reference to undefined global `A2'
Command exited with code 2.

The problem is that a2.cmo should be included but is not. The linking is
done correctly if I do any of the following:
- delete a2.mli
- in prog.ml, directly call Lib.A.f (which is what Sup.B.g is defined as)
- in prog.ml, directly call B.g, without packing B in Sup

I would appreciate any help. Thank you.

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-06-30 21:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-30 21:37 ocamlbuild fails to link dependent module Ashish Agarwal

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).