ocaml / ocaml/dune

Compositional Coq builds depend on the current root

Open
#6,005 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Expected Behavior

Build Coq dune project inner (stdpp) with caching enabled. Then place it inside project outer (iris), then build using outer as root. The code should not be rebuilt.

EDIT: this is important when sharing caches between builds of stdpp and compositional builds of stdpp + iris.

Actual Behavior

When using composition, and the root is outer, the code is built using paths relative to outer, not to outer/inner. That changes the command line and defeats caching.

Here's an example. Running from iris/stdpp with --root .:

Running[2]: (cd _build/default && /Users/pgiarrusso1/.opam/4.14.0+trunk/bin/coqc -q -w -deprecated-hint-rewrite-without-locality -w -deprecated-typeclasses-transparency-without-locality -w -deprecated-syntactic-definition -w -deprecated-native-compiler-option -w -native-compiler-disabled -native-compiler ondemand -R theories stdpp theories/options.v)
cache store success [442fc78b0dbcffaf142efd215cc5a689]

Running from iris with --root .

Running[2]: (cd _build/default && /Users/pgiarrusso1/.opam/4.14.0+trunk/bin/coqc -q -w -deprecated-hint-rewrite-without-locality -w -deprecated-typeclasses-transparency-without-locality -w -deprecated-syntactic-definition -w -deprecated-native-compiler-option -w -native-compiler-disabled -native-compiler ondemand -R theories stdpp theories/options.v)
cache store success [574d71dfc706ac57a5cf8f1f619fd297]

Changing current directory before the build step would fix this cache miss.

Workaround

Create a dummy folder for the outer project even to build only the inner project.

Reproduction

  • PR with a reproducing test:

Specifications

  • Version of dune (output of dune --version): dune 3.4.0
  • Version of ocaml (output of ocamlc --version)
  • Operating system (distribution and version):

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

Reproduce the cache miss by building stdpp as inner and then as part of iris, using the commands and dune 3.4.0 context in the report. Trace how compositional builds choose the current root for paths and cache keys; done when the inner build uses paths relative to outer/inner and reuses the existing cache entry.

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.