[Omake] Subtle dependency problem
Aleksey Nogin
nogin at metaprl.org
Thu May 29 11:49:55 PDT 2008
Alain,
Would not it work correctly if you simply copy the dependencies
recursively? In other words, if you are copying foo.cmi and you have
foo.cmi: bar.cmi dependency, then you also copy bar.cmi? Or would this
result in copying way too much?
Aleksey
On 29.05.2008 09:50, Alain Frisch wrote:
> Dear omake community,
>
> (Nicolas is in Cc: in case the discussion also concerns ocamlbuild.)
>
> In OCaml, some dependencies can only be discovered at type-checking
> time. Indeed, consider the following modules:
>
> a.ml:
> type t = int
>
> b.ml:
> let x : A.t = 1
>
> c.ml:
> B.x + 1
>
> To compile c.ml, we need not only to read b.cmi, but also a.cmi.
> Unfortunately, there is no way to know that by simply looking at its
> code. So of course, ocamldep misses this dependency:
>
> $ ocamldep -modules c.ml
> c.ml: B
>
> In general, this is not a problem, because the build system will compile
> b.ml before c.ml, and so a.cmi will be available anyway. But consider
> the following scenario: c.ml is in another directory than a.ml and b.ml
> and instead of adding an extra -I option, we want to copy a.cmi and
> b.cmi into its directory. So we add to the OMakefile some copying rules
> (with proper dependencies) for these two files. But now, nothing forces
> omake to copy a.cmi in c.ml's directory before compiling c.ml.
>
> This produces tricky errors that are difficult to diagnose because often
> the file a.cmi has already been copied by a former compilation.
>
> A simple way to simplify the diagnosis would be to parse the .cmi files
> after the compilation in order to check that all real dependencies had
> been found by omake. I know how to handle the 'parsing the .cmi' part,
> but I don't know how to implement the 'check' part. Any idea?
>
>
> How should the problem be really addressed? Of course, it is possible to
> force an explicit dependency from c.ml to a.ml (by adding a dummy open
> statement for instance), but this is not very satisfactory. We could
> argue that copying .cmi files around is a bad idea, but there are good
> reasons to do so.
>
> Have people been confronted to such problems already?
>
>
> Alain
>
> _______________________________________________
> Omake mailing list
> Omake at metaprl.org
> https://lists.metaprl.org/mailman/listinfo/omake
>
More information about the Omake
mailing list