caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Josh Watzman <jwatzman@fb.com>
To: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: [Caml-list] "Inconsistent assumptions" when moving files across subdirectories
Date: Mon, 1 Jun 2015 21:52:22 +0000	[thread overview]
Message-ID: <7BA16901-A2D2-48DE-9DA4-065DF74D5B90@fb.com> (raw)

I've noticed that it's pretty easy to confuse ocamlc/ocamlopt when moving a module across subdirectories. Here's an example, the most minimized repro I could get; it uses ocamlbuild, but a similar problem happens if you use OCamlMakefile and I assume other build systems. https://gist.github.com/jwatzman/9979951afb5b87304c18 -- running that will consistently terminate with the dreaded

> Error: Files main.cmx and a/quux.cmx
>        make inconsistent assumptions over interface Quux

(The script flips the quux module back and forth twice, but that's only to exhibit the problem on both 4.01 and 4.02; you can get the same problem with only one move of quux.ml, but which way you need to move it depends on which version of ocaml you're using.)

A clean build will of course resolve the problem, but that's quite annoying to have to go broadcast to a large team, particularly when the build may take many minutes, and when this problem is specific to the OCaml parts of our system (a humongous C++ codebase never requires a clean rebuild). Renaming a module across subdirectories doesn't seem like that uncommon of an operation.

The root problem seems to be that ocamlc/ocamlopt are picking up build artifacts by directory only, and can't be explicitly told which artifacts to pick up, and so they are picking up the "wrong" quux.cmi/cmx left over in a build directory, which ocamlbuild should be cleaning up. Is that right? Is there any way to tell ocamlc/ocamlopt not to do things by directory, but to be more explicit, for the usages of build systems?

Not working around this limitation of ocamlc/ocamlopt seems like a bug in ocamlbuild, no? I'm a bit surprised by it though, given that I've found the same problem in other build systems -- have other folks not run into this? How do other teams deal with this, trying to avoid clean builds?

Thanks!
Josh Watzman


             reply	other threads:[~2015-06-01 21:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01 21:52 Josh Watzman [this message]
2015-06-01 22:15 ` Boris Yakobowski
2015-06-02  8:34 ` Gerd Stolpmann
2015-06-02  9:03   ` Fabrice Le Fessant

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=7BA16901-A2D2-48DE-9DA4-065DF74D5B90@fb.com \
    --to=jwatzman@fb.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).