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

Using (select) with same named library and module give duplicates #6726

Closed
jonahbeckford opened this issue Dec 17, 2022 · 0 comments
Closed
Milestone

Comments

@jonahbeckford
Copy link
Collaborator

Expected Behavior

When compiling ocaml-crunch.3.3.1 with a recent trunk commit of Dune, I expect to see ocaml-crunch compile successfully.

In particular https://github.com/mirage/ocaml-crunch/blob/bd4f0195b35c602b8b83886bc8731e649b1e3f9c/src/dune should build:

(library
 ; Dummy library to detect the OCaml version
 (name realpath)
 (modules)
 (enabled_if
  (< %{ocaml_version} "4.13")))

(library
 (name crunch)
 (wrapped false)
 (synopsis "Compile static files into a static filesystem")
 (modules crunch)
 (public_name crunch)
 (libraries unix ptime)
 (flags :standard -safe-string))

(executable
 (name main)
 (modules main realpath)
 (public_name ocaml-crunch)
 (libraries
  cmdliner
  crunch
  (select
   realpath.ml
   from
   (realpath -> realpath.pre_413.ml)
   (-> realpath.unix.ml))))

(There is a smaller, minimal test case in the reproduction section)

Actual Behavior

Instead I see:

[crunch-4168-afad7d.out] File "src/dune", line 1, characters 0-0:
[crunch-4168-afad7d.out] Error: Module "Realpath" is used in several stanzas:
[crunch-4168-afad7d.out] - src/dune:1
[crunch-4168-afad7d.out] - src/dune:17
[crunch-4168-afad7d.out] To fix this error, you must specify an explicit "modules" field in every
[crunch-4168-afad7d.out] library, executable, and executables stanzas in this dune file. Note that
[crunch-4168-afad7d.out] each module cannot appear in more than one "modules" field - it must belong
[crunch-4168-afad7d.out] to a single library or executable.

Reproduction

  • PR with a reproducing test:

#6725

Specifications

  • Version of dune (output of dune --version):
    n/a (it is a trunk version a237caa)

  • Version of ocaml (output of ocamlc --version)
    4.14.0

  • Operating system (distribution and version):
    Windows 11 22H2 22621.963

jonahbeckford pushed a commit to diskuv/diskuv-opam-repository that referenced this issue Dec 18, 2022
Patch to mitigate ocaml/dune#6726
@rgrinberg rgrinberg added this to the 3.7.0 milestone Feb 28, 2023
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

No branches or pull requests

2 participants