dune
dune copied to clipboard
pkg: generated topfind file contains sandbox paths
The ocamlfind package installs a file lib/toplevel/topfind which contains ocaml source code generated during compilation. When built with dune, this file ends up containing absolute paths to files within the build sandbox which no longer exist after the package has been built.
A temporary workaround for this problem is to use a regexp to remove the sandbox components from paths in the topfind file: https://github.com/gridbugs/ocamlfind/commit/e8c4bf091f6037c2de483a67e2b0a72dc9b9e4d8
This feels like a similar issue to https://github.com/ocaml/dune/issues/10290 in that it involves a generated file containing paths to files within the build sandbox.
One of the things that make this difficult is that the #directory directive does not support strings:
Directive `directory' expects a `string' literal, got an identifier.
Thus making it harder to just compute the correct location. I have some idea how to tackle this (generate a file that uses #directives with the right path) but need to see if this can be used to solve this problem, like for example "where to write this file so that it can be loaded with #use".