caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* ocamlbuild bug (?) with -pack and .d.byte
@ 2007-07-07  0:53 Jake Donham
  0 siblings, 0 replies; only message in thread
From: Jake Donham @ 2007-07-07  0:53 UTC (permalink / raw)
  To: caml-list

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

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

only message in thread, other threads:[~2007-07-07 11:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-07  0:53 ocamlbuild bug (?) with -pack and .d.byte Jake Donham

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