dune icon indicating copy to clipboard operation
dune copied to clipboard

Unexpected find result concerning included module

Open n-osborne opened this issue 1 year ago • 2 comments

Expected Behavior

Dune should build the project or tell me what's wrong.

Actual Behavior

$ dune build
Internal error, please report upstream including the contents of _build/log.
Description:
  ("Unexpected find result", { found = Not_found; lib.name = "lib_core" })
Raised at Stdune__code_error.raise in file "otherlibs/stdune/code_error.ml",
  line 11, characters 30-62
Called from Fiber__scheduler.exec in file "src/fiber/scheduler.ml", line 69,
  characters 8-11
-> required by ("<unnamed>", ())
-> required by ("<unnamed>", ())
-> required by ("<unnamed>", ())
-> required by ("load-dir", In_build_dir "default/bin")
-> required by ("<unnamed>", ())
-> required by ("build-alias", { dir = "default"; name = "default" })
-> required by ("toplevel", ())

I must not crash.  Uncertainty is the mind-killer. Exceptions are the
little-death that brings total obliteration.  I will fully express my cases.
Execution will pass over me and through me.  And when it has gone past, I
will unwind the stack along its path.  Where the cases are handled there will
be nothing.  Only I will remain.

Reproduction

I manage to come up with a minimal example:

  1. download and unzip dune-bug.zip
  2. cd dune-bug
  3. dune build

There is a package pack with

  • a private module lib_core
  • a package pack containing
  • a library lib_dep that open lib_core
  • a top-level library LIB with a public name, opening lib_dep and including lib_core

And, in another directory bin, a program depending on this package pack.

:exclamation: The problem occurs when there is a dune-project file in the bin directory.

Specifications

  • Version of dune (output of dune --version): 3.3.1
  • Version of ocaml (output of ocamlc --version) 5.0.0~alpha1
  • Operating system (distribution and version): Manjaro

Additional information

n-osborne avatar Sep 19 '22 09:09 n-osborne

Thanks. I reduced that to:

  $ cat > ./dune-project << EOF
  > (lang dune 2.9)
  > (package (name pub))
  > EOF

  $ cat > dune << EOF
  > (library
  >  (public_name pub)
  >  (modules pub)
  >  (libraries priv))
  > 
  > (library
  >  (name priv)
  >  (modules priv)
  >  (package pub)
  >  (libraries dep))
  > 
  > (library
  >  (name dep)
  >  (modules dep))
  > EOF

  $ touch pub.ml
  $ touch priv.ml
  $ touch dep.ml

  $ mkdir bin

  $ cat > ./bin/dune-project << EOF
  > (lang dune 2.9)
  > EOF

  $ cat > ./bin/dune << EOF
  > (executable
  >  (name prog)
  >  (libraries pub))
  > EOF

  $ touch ./bin/prog.ml

  $ dune build

priv is private dependency of a public library, which has special semantics (it gets privately installed) - I suppose that all of its private dependencies should get the same treatment. Not sure why it doesn't work across projects.

emillon avatar Sep 21 '22 12:09 emillon

See #6157

emillon avatar Sep 21 '22 13:09 emillon

Fixed.

rgrinberg avatar Nov 08 '22 01:11 rgrinberg