Skip to content

dune-site does not work with opam #4198

@kit-ty-kate

Description

@kit-ty-kate

Expected Behavior

dune-site should work when used in a package installed by opam.
In my opinion the destination directory given by dune-site should always return exactly one directory:

  • either _build/install/default/<dir> when called from the source code by dune
  • or ../<dir> when called from a directory called bin/ (e.g. _build/install/default/bin/ or $prefix/bin)
  • default to /usr/local/<dir> otherwise (or maybe give just None)

Actual Behavior

The current implementation of dune-site does not work when the package in installed by opam.
The destination directory given by dune-site returns [] when the program is called directly without having called dune install before.

Reproduction

$ cat dune-project
(lang dune 2.8)
(using dune_site 0.1)

(package
 (name test)
 (sites (lib_root test)))
$ cat dune
(executable
 (public_name test)
 (libraries dune-site))

(generate_sites_module
 (module test_libdir)
 (sites test))

(install
 (section (site (test test)))
 (files a))
$ touch a
$ cat test.ml
let _ = List.hd Test_libdir.Sites.test
$ dune build -p test
$ ./_build/install/default/bin/test
Fatal error: exception Failure("hd")

Specifications

  • Version of dune (output of dune --version): 2.8.2

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