ocaml / dune

A composable build system for OCaml.
https://dune.build/
MIT License
1.56k stars 395 forks source link

Internal error: Invalid Package_version.t #10674

Open OlivierNicole opened 1 week ago

OlivierNicole commented 1 week ago

Expected Behavior

dune build @install -j auto --profile dev should work.

Actual Behavior

Internal error, please report upstream including the contents of _build/log.
Description:
  ("Invalid Package_version.t", { s = "" })
Raised at Stdune__Code_error.raise in file
  "otherlibs/stdune/src/code_error.ml", line 10, characters 30-62
Called from Stdune__Option.O.(>>|) in file "otherlibs/stdune/src/option.ml",
  line 9, characters 21-26
Called from Stdune__Option.map in file "otherlibs/stdune/src/option.ml"
  (inlined), line 22, characters 15-28
Called from Dune_rules__Package.load_opam_file_with_contents in file
  "src/dune_rules/package.ml" (inlined), line 74, characters 35-74
Called from Dune_rules__Package.load_opam_file_with_contents in file
  "src/dune_rules/package.ml", line 74, characters 13-75
Called from Fiber__Core.O.(>>|).(fun) in file "vendor/fiber/src/core.ml",
  line 253, characters 36-41
Called from Fiber__Scheduler.exec in file "vendor/fiber/src/scheduler.ml",
  line 76, characters 8-11
-> required by ("find-dir-raw", In_source_tree ".")
-> required by ("dune_load", ())
-> required by ("Super_context.all", ())
-> required by ("toplevel", ())

build.log:

# dune build @install -j auto --profile dev
# OCAMLPARAM: unset
# Shared cache: disabled
# Shared cache location: /home/olivier/.cache/dune/db
# Workspace root: /home/olivier/hacking_days/pyre-check/source
# Auto-detected concurrency: 8
# Dune context:
#  { name = "default"
#  ; kind = "default"
#  ; profile = Dev
#  ; merlin = true
#  ; fdo_target_exe = None
#  ; build_dir = In_build_dir "default"
#  ; instrument_with = []
#  }

Reproduction

Specifications

OlivierNicole commented 1 week ago

Mm, in fact I cannot reproduce on a fresh clone of the above repo. It looks like I need to first bring the directory to a “dirty” state.

OlivierNicole commented 1 week ago

How I arrived to the error was by doing a (successful) build, then modifying a version number in scripts/setup.py and re-running ./scripts/setup.sh --local.

OlivierNicole commented 1 week ago

I think I found the source of the bug: in the repo, both files hack_parallel.opam and pyrelib.opam declare an empty string for the version: field. It looks like Dune does not handle this error gracefully.