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

dune build hangs under Windows #1303

Closed
nojb opened this issue Sep 20, 2018 · 10 comments · Fixed by ocaml/opam-repository#12693
Closed

dune build hangs under Windows #1303

nojb opened this issue Sep 20, 2018 · 10 comments · Fixed by ocaml/opam-repository#12693

Comments

@nojb
Copy link
Collaborator

nojb commented Sep 20, 2018

I am getting this when trying to build master under Windows:

...
ocamldep returned unexpected output for _build/default/src/stdune/either.ml:
-> required by src/stdune/.stdune.objs/either.ml.d
-> required by src/stdune/.stdune.objs/either.ml.all-deps
-> required by src/stdune/stdune.cmxa
-> required by bin/main_dune.exe
-> required by _build/install/default/bin/dune.exe
-> required by dune.install
...

and then it hangs a little while later.

@ghost
Copy link

ghost commented Sep 20, 2018

It might be related to the changes to the scheduler indeed. We recently started using system threads to acknowledge various source of events. Although given the way we use threads it should work the same between Unix and Windows.

I've seen similar transient errors in the past though. One things that is frustrating about ocamldep is that when it fails it fails silently and still returns with exit code 0.

@ghost
Copy link

ghost commented Sep 20, 2018

One thing you could try is the following: look for Build.run ~cotext (Ok context.ocamldep) in src/ocamldep.ml, then replace it by:

Build.progn
   [ Build.action ~targets:[] (Copy (file, Path.relative (Path.of_string <temp-dir>) (Path.to_string file)))
   ; Build.run ...
   ]

then look at the file ocamldep saw for the reported file.

@nojb
Copy link
Collaborator Author

nojb commented Sep 20, 2018

I did this, but am not sure what I am looking for...

@ghost
Copy link

ghost commented Sep 20, 2018

I was wondering if ocamldep was seeing a truncated or inexistant .ml file for instance.

@ghost
Copy link

ghost commented Sep 20, 2018

In which case it would output nothing. Thinking about it again, it's not going to help as the file copy will be done by Dune itself. We'd need to change the ocamldep command itslef to check that. You could try that by replacing get_ocaml_tool_exn "ocamldep" in src/context.ml by another command that saves the input somewhere.

@ghost
Copy link

ghost commented Sep 20, 2018

That doesn't explain why it hangs though...

@ghost
Copy link

ghost commented Sep 20, 2018

BTW, is it easy to reproduce? I.e. any chance you could bisect the issue to see if it is #1299 or another commit?

@nojb
Copy link
Collaborator Author

nojb commented Sep 20, 2018

Yes, it happens every time. Will check which commit it is and come back here.

@nojb
Copy link
Collaborator Author

nojb commented Sep 20, 2018

I think the culprit is 0c4503b.

@ghost ghost closed this as completed in 0b36486 Sep 22, 2018
rgrinberg added a commit to rgrinberg/opam-repository that referenced this issue Sep 23, 2018
CHANGES:

- Support colors on Windows (ocaml/dune#1290, @diml)

- Allow `dune.configurator` and `base` to be used together (ocaml/dune#1291, fix
  ocaml/dune#1167, @diml)

- Support interrupting and restarting builds on file changes (ocaml/dune#1246,
  @kodek16)

- Fix findlib-dynload support with byte mode only (ocaml/dune#1295, @bobot)

- Make `dune rules -m` output a valid makefile (ocaml/dune#1293, @diml)

- Expand variables in `(targets ..)` field (ocaml/dune#1301, ocaml/dune#1320, fix ocaml/dune#1189, @nojb,
  @rgrinberg, @diml)

- Fix a race condition on Windows that was introduced in 1.2.0
  (ocaml/dune#1304, fix ocaml/dune#1303, @diml)

- Fix the generation of .merlin files to account for private modules
  (@rgrinberg, fix ocaml/dune#1314)

- Exclude the local opam switch directory (`_opam`) from the list of watched
  directories (ocaml/dune#1315, @dysinger)

- Fix compilation of the module generated for `findlib.dynload`
  (ocaml/dune#1317, fix ocaml/dune#1310, @diml)
rgrinberg added a commit to rgrinberg/opam-repository that referenced this issue Sep 23, 2018
CHANGES:

- Support colors on Windows (ocaml/dune#1290, @diml)

- Allow `dune.configurator` and `base` to be used together (ocaml/dune#1291, fix
  ocaml/dune#1167, @diml)

- Support interrupting and restarting builds on file changes (ocaml/dune#1246,
  @kodek16)

- Fix findlib-dynload support with byte mode only (ocaml/dune#1295, @bobot)

- Make `dune rules -m` output a valid makefile (ocaml/dune#1293, @diml)

- Expand variables in `(targets ..)` field (ocaml/dune#1301, ocaml/dune#1320, fix ocaml/dune#1189, @nojb,
  @rgrinberg, @diml)

- Fix a race condition on Windows that was introduced in 1.2.0
  (ocaml/dune#1304, fix ocaml/dune#1303, @diml)

- Fix the generation of .merlin files to account for private modules
  (@rgrinberg, fix ocaml/dune#1314)

- Exclude the local opam switch directory (`_opam`) from the list of watched
  directories (ocaml/dune#1315, @dysinger)

- Fix compilation of the module generated for `findlib.dynload`
  (ocaml/dune#1317, fix ocaml/dune#1310, @diml)
@nojb
Copy link
Collaborator Author

nojb commented Sep 24, 2018

Thanks for the quick fix!

rgrinberg added a commit to rgrinberg/opam-repository that referenced this issue Sep 24, 2018
CHANGES:

- Support colors on Windows (ocaml/dune#1290, @diml)

- Allow `dune.configurator` and `base` to be used together (ocaml/dune#1291, fix
  ocaml/dune#1167, @diml)

- Support interrupting and restarting builds on file changes (ocaml/dune#1246,
  @kodek16)

- Fix findlib-dynload support with byte mode only (ocaml/dune#1295, @bobot)

- Make `dune rules -m` output a valid makefile (ocaml/dune#1293, @diml)

- Expand variables in `(targets ..)` field (ocaml/dune#1301, ocaml/dune#1320, fix ocaml/dune#1189, @nojb,
  @rgrinberg, @diml)

- Fix a race condition on Windows that was introduced in 1.2.0
  (ocaml/dune#1304, fix ocaml/dune#1303, @diml)

- Fix the generation of .merlin files to account for private modules
  (@rgrinberg, fix ocaml/dune#1314)

- Exclude the local opam switch directory (`_opam`) from the list of watched
  directories (ocaml/dune#1315, @dysinger)

- Fix compilation of the module generated for `findlib.dynload`
  (ocaml/dune#1317, fix ocaml/dune#1310, @diml)

- Lift restriction on `copy_files` and `copy_files#` stanzas that files to be
  copied should be in a subdirectory of the current directory.
  (ocaml/dune#1323, fix ocaml/dune#911, @nojb)
shonfeder pushed a commit to shonfeder/dune that referenced this issue Dec 31, 2018
- protect the pid table and waiting for processes by a mutex on windows
  to avoid pid collision problems
- generally refactr the scheduler, in particular we now use a single
  communication channel and interpret events at a single place

Fixes ocaml#1303

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant