Skip to content

dune build --watch + dune exec + DUNE_BUILD_DIR does not work #13080

@yakobowski

Description

@yakobowski

After #12473, running dune build --watch and dune exec in parallel works great. That's fantastic, thanks a lot. However, I observe an issue when DUNE_BUILD_DIR is also set.

Expected Behavior

The binary under $DUNE_BUILD_DIR is rebuilt if needed, and executed.

Actual Behavior

Error message about not being able to build the binary

Error: Don't know how to build

Reproduction

  • PR with a reproducing test:
  1. Repro code

dune:

(executable
 (name test_watch))

dune-project:

(lang dune 2.8)

test_watch.ml:

let () = print_endline "Hello, World!"
dune build -w &
Success, waiting for filesystem changes...
dune exec ./test_watch.exe 
Hello, World!

Works! (make sure to kill the watcher)

export DUNE_BUILD_DIR=$HOME/tmp/dune
mkdir -p $DUNE_BUILD_DIR
dune build -w &
Success, waiting for filesystem changes...
dune exec ./test_watch.exe 
Error: Don't know how to build /home/byakobow/tmp/dune/default/test_watch.exe
Had 1 error, waiting for filesystem changes...Warning:
Your build request is being forwarded to a running Dune instance (pid:
4113118). Note that certain command line arguments may be ignored.
Error: Don't know how to build /home/byakobow/tmp/dune/default/test_watch.exe
Error: Build failed with 1 error.
Had 1 error, waiting for filesystem changes...

Specifications

  • Version of dune (output of dune --version): 3.20.2-1064-ge29a36c (trunk as of right now)
  • Version of ocaml (output of ocamlc --version): 4.14.2
  • Operating system (distribution and version): Debian oldstable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions