Skip to content

virtual libraries: "dune build @check" bug? #12636

@sanette

Description

@sanette

Expected Behavior

I should be able to use the "default_implementation" stanza for producing a unique package that ships the virtual library and its default implementation.

dune build @check should work

Actual Behavior

dune build works but dune build @check crashes

Reproduction

https://discuss.ocaml.org/t/dune-virtual-libraries-default-implementation-bug/17423/3

* File: ./test.opam
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "Virtual test library with a default implementation"
depends: [
  "dune" {>= "3.10"}
  "odoc" {with-doc}
]
build: [
  ["dune" "subst"] {dev}
  [
    "dune"
    "build"
    "-p"
    name
    "-j"
    jobs
    "@install"
    "@runtest" {with-test}
    "@doc" {with-doc}
  ]
]

* File: ./default_impl/dune
(library
 (name test_a)
 (public_name test.a)
 (implements test)
)

* File: ./default_impl/a.ml
let compute x = x + 1

* File: ./lib/a.mli
val compute : int -> int

* File: ./lib/test.ml
let run x = A.compute x * 2

* File: ./lib/dune
(library
 (name test)
 (public_name test)
 (virtual_modules a)
 (default_implementation test.a)
)

* File: ./dune-project
(lang dune 3.10)
(name test)
(generate_opam_files true)

Specifications

  • Version of dune (output of dune --version): 3.20.2

  • Version of ocaml (output of ocamlc --version): 5.3.0

  • Operating system (distribution and version): ubuntu 24.04

Additional information

see https://discuss.ocaml.org/t/dune-virtual-libraries-default-implementation-bug/17423

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions