ocaml / ocaml/dune

Vendored libraries are not linked statically to public libraries that use them

Open
#5,301 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

vendoring
Dominant language
OCaml
Stars
1.9k
Forks
500
Avg merge
15h 21m
Merged PRs (30d)
277

Description

Hello, I'm having an issue about the git submodules installation with opam. This is more certainly an issue on my side but I come here to ask for your help, feel free to close if you do not have the time and/or do not want to look at this :).

I am writing a library and executable with dune:

(library
 (public_name ometrics.core)
 ...

; and
(executable
 (public_name ometrics)
 ...

I am now trying to install this in another project by doing:

opam pin add ometrics git+https://gitlab.com/nomadic-labs/ometrics.git#battle-test

The executable ometrics works fine but if I try to use the library ometrics.core as a dependency I get:

10 |  (requires unix str merlin.kernel merlin.analysis)
                                       ^^^^^^^^^^^^^^^
Error: Library "merlin.analysis" not found.
-> required by library "ometrics.core" in
   /home/valentin/Documents/ometrics/merbocop/_opam/lib/ometrics/core
Hint: try:
  dune external-lib-deps --missing @@default

which is the library introduced by my submodule. Can the git submodules work as well for libraries ?

The project for reference: https://gitlab.com/nomadic-labs/ometrics/-/tree/snapshot-issue and my opam version:

$ opam --version
2.0.5

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the installation from the referenced snapshot using the shown opam pin command and opam 2.0.5. Start with the Dune library and executable declarations, then inspect the dependency reported by dune external-lib-deps --missing. Done means a consumer can use ometrics.core after installation without the vendored merlin.analysis library being unavailable.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.