dune icon indicating copy to clipboard operation
dune copied to clipboard

`dune build @ocaml-index` fails when depending on a package with package management enabled

Open liate7 opened this issue 5 months ago • 0 comments

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 of dune --version): "Dune Developer Preview: build 2024-10-02T07:47:55+00:00, git revision 451e5b4463c4fe5b4f5427c0a40a5962c38ccc0f"
  • Version of ocaml (output of ocamlc --version)
  • Operating system (distribution and version): Linux 6.10.7, Guix System

Additional information

liate7 avatar Oct 02 '24 19:10 liate7