caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Jake Donham" <jake.donham@skydeck.com>
To: caml-list@inria.fr
Subject: ocamlbuild bug (?) with -pack and .d.byte
Date: Fri, 6 Jul 2007 17:53:26 -0700	[thread overview]
Message-ID: <c7e4e9f0707061753r6dcd35e0re90bef7e38822e74@mail.gmail.com> (raw)

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

Hi,

(Please excuse the repost--not sure if the first try went through.)

It seems to me that ocamlbuild does not correctly handle dependencies
inside packed modules. In the attached example, test1.ml depends on
foo/one.ml, which in turn depends on bar/two.ml. Foo and bar are
packed. If you build test1.byte it works fine, but test1.d.byte fails
to link. The included myocamlbuild.ml works around it (described
below).

If I read things right, the list of targets needing building before
linking is computed in Ocaml_compiler.prepare_link. This uses
Ocamldep.module_dependencies, which does not reflect the dependencies
inside packed modules. The list of objects actually linked in,
however, is computed by  caml_transitive_closure in
Ocaml_compiler.link_gen, which handles packed modules correctly.

When building the non-debug target, the appropriate .cmo files are
built as a side-effect of building the .cmi files, and they are
present when we get to Ocaml_compiler.link_gen (i.e. linking works
only by accident). But when building the debug target, we get .cmo
files as a side-effect of building .cmi files, but not the .d.cmo
files we need, so linking fails.

My workaround is to replace the standard pack rules with rules that
also register the dependencies inside the packed module. I would
appreciate it if someone who knows better could take a look at the
situation. Thanks,

Jake

[-- Attachment #2: test.tar.gz --]
[-- Type: application/x-gzip, Size: 944 bytes --]

                 reply	other threads:[~2007-07-07 11:39 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=c7e4e9f0707061753r6dcd35e0re90bef7e38822e74@mail.gmail.com \
    --to=jake.donham@skydeck.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).