ocaml / ocaml/dune

Rule collision when multiple vendored projects contain executables with matching names

Open
#6,830 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Expected Behavior

It should be possible to vendor multiple packages which contain executables whose names (public_name in dune files) are the same. The source code for a package may contain executables for testing and experimentation, but typically one vendors a package just to get access to the libraries it contains.

Actual Behavior

When resolving install stanzas that target the bin section, or expanding %{bin:...} expressions, dune gives an error Multiple rules generated ...

Reproduction

I've made a small project to reproduce the issue: https://github.com/gridbugs/dune-vendored-projects-rule-collision-repro

It vendors two packages: OSCADml.0.1.1 and scad_ml.1.1.0. Both those packages contain executables named "circle". The dune file contains an install stanza which installs a shell script into the bin section. Running dune build @install gives the error:

Error: Multiple rules generated for _build/install/default/bin/circle:
- vendored/scad_ml.1.1.0/test/dune:3
- vendored/OSCADml.0.1.1/test/dune:3
-> required by
   _build/default/dune-vendored-projects-rule-collision-repro.install
-> required by alias install

Specifications

  • Version of dune (output of dune --version): 3.6.1
  • Version of ocaml (output of ocamlc --version): 5.0.0
  • Operating system (distribution and version): NixOS (linux 6.1.1)

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 linked reproduction project and run dune build @install to reproduce the collision. Inspect the install stanza and the conflicting vendored/scad_ml.1.1.0/test/dune:3 and vendored/OSCADml.0.1.1/test/dune:3 entries. Done means multiple vendored packages with matching executable names no longer produce duplicate rules when resolving the bin install section or %{bin:...} expressions.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.