In cases where the libdir computed by ocamlbuild -where doesn't contain the expected ocamlbuild library files, attempt to guess an alternative libdir relative to the currently running executable's path (using Sys.executable_name). If the resulting libdir does contain the expected ocamlbuild library files then a warning is printed and the guessed libdir is used.
The motivation for this change is to allow the ocamlbuild (opam) package to be built by dune's package management features. Dune builds opam packages by executing their build and install commands in a temporary sandbox environment, and then copying the resulting artifacts to a final installation path. This creates a problem for ocamlbuild as the OCAMLBUILD_LIBDIR variable set at build time will be a path inside the temporary sandbox. That path is then used to compute the value printed by ocamlbuild -where which consequently reports a non-existant path.
This is an attempt to satisfy dune's constraint that a package's installed files must work after copying them out of their original install location.
In cases where the libdir computed by
ocamlbuild -where
doesn't contain the expected ocamlbuild library files, attempt to guess an alternative libdir relative to the currently running executable's path (usingSys.executable_name
). If the resulting libdir does contain the expected ocamlbuild library files then a warning is printed and the guessed libdir is used.The motivation for this change is to allow the ocamlbuild (opam) package to be built by dune's package management features. Dune builds opam packages by executing their build and install commands in a temporary sandbox environment, and then copying the resulting artifacts to a final installation path. This creates a problem for ocamlbuild as the
OCAMLBUILD_LIBDIR
variable set at build time will be a path inside the temporary sandbox. That path is then used to compute the value printed byocamlbuild -where
which consequently reports a non-existant path.This is an attempt to satisfy dune's constraint that a package's installed files must work after copying them out of their original install location.
We discussed this a little in https://github.com/ocaml/ocamlbuild/issues/326. This is intended to fix this issue: https://github.com/ocaml/dune/issues/10290.