Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected find result concerning included module #6153

Closed
n-osborne opened this issue Sep 19, 2022 · 3 comments · Fixed by ocaml/opam-repository#22498
Closed

Unexpected find result concerning included module #6153

n-osborne opened this issue Sep 19, 2022 · 3 comments · Fixed by ocaml/opam-repository#22498
Assignees
Milestone

Comments

@n-osborne
Copy link

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.

❗ 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

@emillon
Copy link
Collaborator

emillon commented Sep 21, 2022

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 added a commit to emillon/dune that referenced this issue Sep 21, 2022
Signed-off-by: Etienne Millon <[email protected]>
@emillon
Copy link
Collaborator

emillon commented Sep 21, 2022

See #6157

emillon added a commit to emillon/dune that referenced this issue Oct 5, 2022
Signed-off-by: Etienne Millon <[email protected]>
emillon added a commit to emillon/dune that referenced this issue Oct 5, 2022
Signed-off-by: Etienne Millon <[email protected]>
rgrinberg pushed a commit to emillon/dune that referenced this issue Oct 22, 2022
rgrinberg pushed a commit to emillon/dune that referenced this issue Oct 22, 2022
@rgrinberg rgrinberg added this to the 3.6.0 milestone Oct 22, 2022
@rgrinberg rgrinberg linked a pull request Oct 22, 2022 that will close this issue
@rgrinberg
Copy link
Member

Fixed.

emillon added a commit to emillon/opam-repository that referenced this issue Nov 14, 2022
…ne-site, dune-rpc, dune-rpc-lwt, dune-private-libs, dune-glob, dune-configurator, dune-build-info, dune-action-plugin and chrome-trace (3.6.0)

CHANGES:

- Forbid multiple instances of dune running concurrently in the same workspace.
  (ocaml/dune#6360, fixes ocaml/dune#236, @rgrinberg)

- Allow promoting into source directories specified by `subdir` (ocaml/dune#6404, fixes
  ocaml/dune#3502, @rgrinberg)

- Make dune describe workspace return the correct root path
  (ocaml/dune#6380, fixes ocaml/dune#6379, @esope)

- Introduce a `$ dune ocaml top-module` subcommand to load modules directly
  without sealing them behind the signature. (ocaml/dune#5940, @rgrinberg)

- [ctypes] do not mangle user written names in the ctypes stanza (ocaml/dune#6374, fixes
  ocaml/dune#5561, @rgrinberg)

- Support `CLICOLOR` and `CLICOLOR_FORCE` to enable/disable/force ANSI
  colors. (ocaml/dune#6340, fixes ocaml/dune#6323, @MisterDA).

- Forbid private libraries with `(package ..)` set from depending on private
  libraries that don't belong to a package (ocaml/dune#6385, fixes ocaml/dune#6153, @rgrinberg)

- Allow `Byte_complete` binaries to be installable (ocaml/dune#4873, @AltGr, @rgrinberg)

- Revive `$ dune external-lib-deps` under `$ dune describe external-lib-deps`.
  (ocaml/dune#6045, @moyodiallo)

- Fix running inline tests in bytecode mode (ocaml/dune#5622, fixes ocaml/dune#5515, @dariusf)

- [ctypes] always re-run `pkg-config` because we aren't tracking its external
  dependencies (ocaml/dune#6052, @rgrinberg)

- [ctypes] remove dependency on configurator in the generated rules (ocaml/dune#6052,
  @rgrinberg)

- Build progress status now shows number of failed jobs (ocaml/dune#6242, @Alizter)

- Allow absolute build directories to find public executables. For example,
  those specified with `(deps %{bin:...})` (ocaml/dune#6326, @anmonteiro)

- Create a fake socket file `_build/.rpc/dune` on windows to allow rpc clients
  to connect using the build directory. (ocaml/dune#6329, @rgrinberg)

- Prevent crash if absolute paths are used in the install stanza and in
  recursive globs. These cases now result in a user error. (ocaml/dune#6331, @gridbugs)

- Add `(glob_files <glob>)` and `(glob_files_rec <glob>)` terms to the `files`
  field of the `install` stanza (ocaml/dune#6250, closes ocaml/dune#6018, @gridbugs)

- Allow `:standard` in the `(modules)` field of the `coq.pp` stanza (ocaml/dune#6229,
  fixes ocaml/dune#2414, @Alizter)

- Fix passing of flags to dune coq top (ocaml/dune#6369, fixes ocaml/dune#6366, @Alizter)

- Extend the promotion CLI to a `dune promotion` group: `dune promote` is moved
  to `dune promotion apply` (the former still works) and the new `dune promotion
  diff` command can be used to just display the promotion without applying it.
  (ocaml/dune#6160, fixes ocaml/dune#5368, @emillon)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment