Skip to content

Dependency Generation Does Not Include Executables? #36

@zepalmer

Description

@zepalmer

It seems that, if a BuildDepends entry appears in an Executable but not in a Library, it is not included in the opam file. For instance, my project includes a single library with the following BuildDepends:

  BuildDepends:
    batteries,
    monadlib,
    ocaml-monadic,
    ppx_deriving.std (>= 2.0),
    yojson

It has a single executable with this BuildDepends:

  BuildDepends:
    batteries,
    jhupllib,
    oUnit,
    ppx_deriving.std (>= 2.0),
    ppx_deriving_yojson

The resulting opam file contains this depends entry:

depends: [
  "base-threads"
  "batteries"
  "monadlib"
  "oasis" {build & >= "0.4.7"}
  "ocaml-monadic"
  "ocamlbuild" {build}
  "ocamlfind" {build}
  "ounit" {build}
  "ppx_deriving" {>= "2.0"}
  "yojson"
]

As a result, the OPAM package fails to install unless the user has already manually installed ppx_deriving_yojson. Am I misunderstanding the function of these fields? Is this an oversight?

The above project can be found here. Steps to reproduce:

mkdir -p ztemp
cd ztemp
export OPAMROOT="$(pwd)/opam"
mkdir -p $OPAMROOT
opam init
eval `opam config env`
git clone https://github.com/JHU-PL-Lab/jhu-pl-lib.git
cd jhu-pl-lib
git checkout c901c56ea93640e5aaa0232e6b05000e5f87120b
opam pin add jhupllib .

The last command will fail with an error message something like this:

#=== ERROR while installing jhupllib.0.1+dev ==================================#
# opam-version 1.2.2
# os           linux
# command      ocaml setup.ml -configure --prefix /home/zpalmer/ztemp/opam/4.04.1
# path         /home/zpalmer/ztemp/opam/4.04.1/build/jhupllib.0.1+dev
# compiler     4.04.1
# exit-code    1
# env-file     /home/zpalmer/ztemp/opam/4.04.1/build/jhupllib.0.1+dev/jhupllib-4107-aaa640.env
# stdout-file  /home/zpalmer/ztemp/opam/4.04.1/build/jhupllib.0.1+dev/jhupllib-4107-aaa640.out
# stderr-file  /home/zpalmer/ztemp/opam/4.04.1/build/jhupllib.0.1+dev/jhupllib-4107-aaa640.err
### stderr ###
# ocamlfind: Package `ppx_deriving_yojson' not found

Please let me know if I can provide additional information. Thank you for the tool!

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