ocaml / dune

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

Dune crash with melange-webapi on Windows #10764

Open ManasJayanth opened 1 month ago

ManasJayanth commented 1 month ago

Expected Behavior

Doesn't crash

Actual Behavior

Crash with the following logs

Internal error, please report upstream including the contents of _build/log.
Description:
  ("Path.drop_prefix_exn",
  { t =
      External
        "C:\\Users\\prome\\AppData\\Local\\opam\\5.2.0\\lib\\melange-webapi\\Webapi/Dom"
  ; prefix =
      External
        "C:\\Users\\prome\\AppData\\Local\\opam\\5.2.0\\lib\\melange-webapi"
  })
Raised at Stdune__Code_error.raise in file
  "otherlibs/stdune/src\\code_error.ml", line 10, characters 30-62
Called from Dune_rules__Melange_rules.lib_output_path in file
  "src/dune_rules\\melange\\melange_rules.ml" (inlined), line 25, characters
  8-48
Called from Dune_rules__Melange_rules.make_js_name in file
  "src/dune_rules\\melange\\melange_rules.ml", line 35, characters 21-65
Called from Dune_rules__Melange_rules.build_js.(fun) in file
  "src/dune_rules\\melange\\melange_rules.ml", line 207, characters 21-51
Called from Fiber__Scheduler.exec in file "vendor/fiber/src\\scheduler.ml",
  line 76, characters 8-11
-> required by ("<unnamed>", ())
-> required by ("<unnamed>", ())
-> required by ("load-dir", In_build_dir "default/output")
-> required by ("build-file", In_build_dir "default/output/App.js")
-> required by ("<unnamed>", ())
-> required by
   ("build-alias", { dir = In_build_dir "default"; name = "all" })
-> required by ("<unnamed>", ())
-> required by
   ("build-alias", { dir = In_build_dir "default"; name = "default" })
-> required by ("toplevel", ())
Internal error, please report upstream including the contents of _build/log.
Description:

Reproduction

https://github.com/ManasJayanth/dune-crash-melange-webapi

  1. install the deps with opam install . --deps-only -y
  2. Run opam exec -- dune build -w

Specifications

Additional information

(See logs.txt in the repo)

anmonteiro commented 1 month ago

this is likely related to windows paths and the stdune path library? we remove the trailing slash to get the module path and expect /, not \.