ocaml / ocaml/dune

Internal error: link_many: unable to find module

Open
#10,285 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

c-bindings
Dominant language
OCaml
Stars
1.9k
Forks
500
Avg merge
15h 21m
Merged PRs (30d)
277

Description

Expected Behavior

Dune should not crash.

Actual Behavior

Dune crashes with the following message:

Internal error, please report upstream including the contents of _build/log.
Description:
  ("link_many: unable to find module",
  { main_module_name = "Libzstd__type_gen"
  ; modules =
      Singleton
        { source =
            { path = [ "Zstd_stubs" ]
            ; files =
                { impl =
                    Some
                      { path = In_build_dir "default/src/zstd_stubs.ml"
                      ; dialect = "ocaml"
                      }
                ; intf = None
                }
            }
        ; obj_name = "zstd_stubs"
        ; pp = None
        ; visibility = "public"
        ; kind = Impl
        ; install_as = None
        }
  })
Raised at Stdune__Code_error.raise in file
  "otherlibs/stdune/src/code_error.ml", line 10, characters 30-62
Called from Dune_rules__Exe.link_many.(fun) in file "src/dune_rules/exe.ml",
  line 284, characters 12-215
Called from Fiber__Scheduler.exec in file "vendor/fiber/src/scheduler.ml",
  line 76, characters 8-11
-> required by ("<unnamed>", ())
-> required by ("load-dir", In_build_dir "default/src")
-> required by ("<unnamed>", ())
-> required by
   ("build-alias", { dir = In_build_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

  1. Download and unpack ocaml-zstd.zip.
  2. Run opam switch create ..
  3. Run dune build.

Specifications

  • Version of dune (output of dune --version): 3.14.2

  • Version of ocaml (output of ocamlc --version): 5.1.1

  • Operating system (distribution and version): Arch Linux

  • Link to gist with verbose output (run dune with the --verbose flag): https://pastebin.com/raw/ZTxqy70Y

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure using ocaml-zstd.zip, opam switch create ., and dune build. Start at src/dune_rules/exe.ml around line 284 and inspect the link_many path for the reported Libzstd__type_gen and Zstd_stubs modules. Done means the reproduction builds without the internal error.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.