ocaml / ocamlbuild

The legacy OCamlbuild build manager
Other
121 stars 81 forks source link

MPR#5293: improve error message on circular build error #215

Open damiendoligez opened 7 years ago

damiendoligez commented 7 years ago

PR transferred from https://caml.inria.fr/mantis/view.php?id=5293 [original reporter: art1]

Hello,

the actual behaviour is not very helpful. If the compiler detects circular builds, it will be very hard to find out, what is the reason for this. It would be more helpful if the compiler reports the lines in the involved modules. Very very helpful would be if the compiler also reports a more detailled explanation and give hints for resolving such conflicts.

gasche commented 7 years ago

We improved the printing of cycles in #44 already, but this PR was actually suggesting a hint in the specific case of module self-reference, where you mistakenly write Foo.bar within foo.ml itself. I still think it would make a lot of sense to special-case this situation and provide a more friendly hint than just showing the self-reference cycle.

whitequark commented 7 years ago

Shouldn't this be fixed in ocamlc rather than ocamlbuild?

gasche commented 7 years ago

The error message is produced by ocamlbuild, which asks ocamldep for dependencies and complains that there is a cycle; I don't think that ocamlc is invoked on foo.ml at all.