Skip to content

dune-project auto generation and it's effect on libraries #1439

@vzaliva

Description

@vzaliva

I am not sure how to exactly formulate the problem, so I will start by describing a scenario:

I have a project with the following structure:

I have the following directory structure:

ml/
   dune
   test.ml
   extracted/
                 dune
                 _(lot of .ml files)_

The ml/dune:

(executables_
 (names test)_
 (libraries extracted))

ml/extracted/dune:

(library
 (name extracted)
 (wrapped false)
 (synopsis "ML code extracted from Coq"))

Doing dune build test.ext under ml complains:

Error: Library “extracted” not found.

I've spent a lot of time to figure out why this is happening. It turns out the problem was in presence of extracted/dune-project file! If this file present, build fails with a cryptic error message. Removing this file fixes the problem.

Some thoughts:

  1. It is unclear why the presence of this file changes the behavior of the build. It looks harmless as contains only the version number.
  2. The error message is not helpful.
  3. I did not create this file. It was auto-created when I tried to run dune in extracted directory.

It looks like the file auto-creation is a dangerous operation as it could break your build. Also, error reporting could be improved.

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