Skip to content

Dune package management: submodules #11606

@giltho

Description

@giltho

Expected Behavior

Dune should behave identically to when handling pinned packages from git that have submodules.
In particular, opam will always recursively initialise submodules when downloading pin packages from git.

Actual Behavior

Pinned dependencies submodules are not recursively initialised.

Reproduction

  • install the dune developer preview
  • Checkout branch dune-issue-11606 of this repo. EDIT: this branch is now deleted given that the issue has been correctly identified and resolved
  • run dune pkg lock && dune build

Also, see this github action run

Output is:

File "vendor/jsonrpc/dune", line 1, characters 12-71:
1 | (copy_files %{project_root}/submodules/ocaml-lsp/jsonrpc/src/*.{ml,mli})
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Cannot find directory: submodules/ocaml-lsp/jsonrpc/src
File "vendor/lsp/dune", line 1, characters 12-71:
1 | (copy_files %{project_root}/submodules/ocaml-lsp/lsp/src/*.{ml,mli,mll})
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Cannot find directory: submodules/ocaml-lsp/lsp/src

This stems from the fact that I'm using the version of linol from this PR, which has ocaml-lsp as a submodule.

Specifications

  • Version of dune (output of dune --version): "Dune Developer Preview: build 2025-04-03T07:55:38Z, git revision cf611d3"
  • Version of ocaml (output of ocamlc --version): 5.3.0
  • Operating system (distribution and version): macOS Sequoia 15.3.2

Additional information

Verbose output (dune build --verbose):

~/.local/bin/dune build --verbose
Shared cache: enabled-except-user-rules
Shared cache location: /Users/sacha/.cache/dune/db
Workspace root: /Users/sacha/Prog/bfa-ocaml
Auto-detected concurrency: 16
Dune context:
{ name = "default"
; kind = lock { default = true }
; profile = Dev
; merlin = true
; fdo_target_exe = None
; build_dir = In_build_dir "default"
; instrument_with = []
}
Actual targets:

  • alias @@default
    Building ocaml-config.3
    Building linol.dev
    Running[1]: (cd _build/_private/default/.pkg/linol/source && /Users/sacha/Prog/bfa-ocaml/_opam/bin/dune build -p linol)
    Context: _private
    Command [1] exited with code 1:
    $ (cd _build/_private/default/.pkg/linol/source && /Users/sacha/Prog/bfa-ocaml/_opam/bin/dune build -p linol)
    File "vendor/jsonrpc/dune", line 1, characters 12-71:
    1 | (copy_files %{project_root}/submodules/ocaml-lsp/jsonrpc/src/.{ml,mli})
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Error: Cannot find directory: submodules/ocaml-lsp/jsonrpc/src
    File "vendor/lsp/dune", line 1, characters 12-71:
    1 | (copy_files %{project_root}/submodules/ocaml-lsp/lsp/src/
    .{ml,mli,mll})
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Error: Cannot find directory: submodules/ocaml-lsp/lsp/src

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions