ocaml / ocaml/dune

`preprocess` `per_module` dependencies are not relative

Open
#7,464 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Expected Behavior

When using preprocess the binary in an run action should be part of

(library
    ...
    (preprocess  (per_module
                  ((action (run ./gen/gen.exe %{input-file})) myModule))))

Should depend on ./gen/gen.exe and build myModule.

Actual Behavior

Preprocessing with ./gen/gen.exe in rule but in preprocess stanzas, it can't find the rule to build gen.exe because it expects ./gen/gen.exe live relative to the workspace and not relative to the dune file that contains the preprocess stanza:

$ dune build
  File "src/.merlin-conf/_unknown_", line 1, characters 0-0:
  Error: No rule found for gen/gen.exe
  [1]

Reproduction

Specifications

  • Version of dune (output of dune --version): current main
  • Version of ocaml (output of ocamlc --version): 4.14.1
  • Operating system (distribution and version): Fedora GNU/Linux

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

Start with the reproducing test in PR #7463 and the Dune contributor guidance in doc/hacking.rst. Reproduce the preprocess/per_module case on current main, then trace how ./gen/gen.exe is resolved relative to the Dune file; done means the dependency is found and myModule builds successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.