Skip to content

Coq cannot find the cmxs file for transitive ocaml dependencies #11012

@rlepigre

Description

@rlepigre

When building Coq theories with plugins depending on OCaml libraries (everything being in a dune workspace) it seems like dune sometimes fails to place .cmxs files for transitive dependencies where Coq expects to find them. Since Coq relies on findlib, it seems like all the OCaml libraries depended on transitively by plugins should be made available in the _build/install directory (or at least a META file for them?).

Here is a tarball with a minimal example of workspace that exhibits the problem: dune_bug_plugin_deps.tar.gz. It contains the following files:

dune_bug_plugin_deps
├── coqlib
│   ├── coqlib.opam
│   ├── coqlib-plugin.opam
│   ├── dune-project
│   ├── plugin
│   │   ├── coqlib_plugin.mlpack
│   │   ├── dune
│   │   └── main.ml
│   └── theories
│       ├── dune
│       └── plugin.v
├── dune-workspace
└── somelib
    ├── dune-project
    ├── somelib.opam
    └── src
        ├── dune
        └── version.ml

To reproduce the problem, simply run:

$ cd dune_bug_plugin_deps
$ dune build coqlib/theories/plugin.vo
File "./coqlib/theories/plugin.v", line 1, characters 0-41:
Error:
Dynlink error: error loading shared library: Failure("[...]/dune_bug_plugin_deps/_build/install/default/lib/somelib/somelib.cmxs: cannot open shared object file: No such file or directory")

This was tested with Coq 8.19, and dune 3.16.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions