caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Ashish Agarwal" <agarwal1975@gmail.com>
To: "Caml List" <caml-list@inria.fr>
Subject: ocamlbuild fails to link dependent module
Date: Mon, 30 Jun 2008 17:37:20 -0400	[thread overview]
Message-ID: <d8be5ae20806301437k543e9c86j25f7ecd151e19b7c@mail.gmail.com> (raw)

[-- 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 --]

                 reply	other threads:[~2008-06-30 21:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d8be5ae20806301437k543e9c86j25f7ecd151e19b7c@mail.gmail.com \
    --to=agarwal1975@gmail.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).