Dune dependency computing

I try to move a project from dune 1.6.3 to dune 1.7. This dune is used to build some embedded cmis files:

 (targets embedded_grading_cmis.ml)
 (deps (:compiler-cmis
 (action (with-stdout-to %{targets}
           (run ocp-ocamlres -format ocamlres %{compiler-cmis} %{generated-cmis})))

 (name grading)
 (wrapped false)
 (modes byte)
 (library_flags :standard -linkall)
 (libraries testing
 (modules Embedded_grading_cmis
 (preprocess (per_module ((pps ppx_ocplib_i18n learnocaml_ppx_metaquot) Grading)))

With the 1.6.3 version everything works great but with the 1.7 version, I get this error and I don’t understand why:

File "src/grader/dune", line 98, characters 0-954:
 98 | (rule
 99 |  (targets embedded_grading_cmis.ml)
100 |  (deps (:compiler-cmis
.....115 |  (action (with-stdout-to %{targets}
116 |            (run ocp-ocamlres -format ocamlres %{compiler-cmis} %{generated-cmis})))
117 | )
Error: No rule found for

Does everyone know if there is a way to fix this ?

It may be that the directory where dune places the built .cmis has changed. You could try with .<libname>.objs/byte/<modname>.cmi, eg .testing.objs/byte/test_lib.cmi (that is what is used in the current version of dune, but not sure if that is also the case for 1.7).

Having said that, two remarks:

  • The exact directory layout is an implementation detail of dune and may change in the future; if the library to which the .cmis belong is public you can use instead %{lib:<public-name>:<modname>.cmi} instead, see https://dune.readthedocs.io/en/stable/concepts.html#variables

  • Any specific reason why you are not upgrading to dune 2, which has many improvements over dune 1?

Best wishes,

Thanks so much for your explanations, it works perfectly.
About your two remarks:

  • Unfortunately, it’s a local library, so I can’t use this syntax…
  • The only reason why I want to move to dune 1.7 is virtual libraries. Otherwise, there isn’t any specific reason to not upgrading to dune 2.0 if it stays compatible with Ocaml 4.05.0. I will give it a try! Thanks!