dune
dune copied to clipboard
`dune build @ocaml-index` fails when depending on a package with package management enabled
This only happens when there's a dune.lock
and one of the dune files in the project depend on a library from outside the project.
Expected Behavior
dune build @ocaml-index
works and builds the index.
Actual Behavior
dune build @ocaml-index
returns 1 with error messages complaining about rules defining directory targets when the rules' actions didn't produce them. For a dummy project only depending on containers
, this was:
Error: This rule defines a directory target "default/.pkg/containers/target"
that matches the requested path
"default/.pkg/containers/target/lib/containers/cctx.ocaml-index" but the
rule's action didn't produce it
-> required by _build/default/lib/.test.objs/cctx.ocaml-index
-> required by alias ocaml-index
Error: This rule defines a directory target "default/.pkg/either/target" that
matches the requested path
"default/.pkg/either/target/lib/either/cctx.ocaml-index" but the rule's
action didn't produce it
-> required by _build/default/lib/.test.objs/cctx.ocaml-index
-> required by alias ocaml-index
Error: This rule defines a directory target "default/.pkg/containers/target"
that matches the requested path
"default/.pkg/containers/target/lib/containers/monomorphic/cctx.ocaml-index"
but the rule's action didn't produce it
-> required by _build/default/lib/.test.objs/cctx.ocaml-index
-> required by alias ocaml-index
Reproduction
mkdir test
cd test
cat > dune-project <<EOF
(lang dune 3.17)
(package
(name test)
(depends ocaml dune containers))
EOF
mkdir bin
cat >bin/dune <<EOF
(executable
(name main)
(libraries containers))
EOF
touch bin/main.ml
dune pkg lock
dune build @ocaml-index
Edit: I've written a pull request for the bug: #10986
Specifications
- Version of
dune
(output ofdune --version
): "Dune Developer Preview: build 2024-10-02T07:47:55+00:00, git revision 451e5b4463c4fe5b4f5427c0a40a5962c38ccc0f" - Version of
ocaml
(output ofocamlc --version
) - Operating system (distribution and version): Linux 6.10.7, Guix System
Additional information
- Link to gist with verbose output (run
dune
with the--verbose
flag):dune build @ocaml-index --verbose