dune icon indicating copy to clipboard operation
dune copied to clipboard

pkg: generated topfind file contains sandbox paths

Open gridbugs opened this issue 1 year ago • 2 comments
trafficstars

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

gridbugs avatar Mar 20 '24 06:03 gridbugs

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.

gridbugs avatar Mar 20 '24 06:03 gridbugs

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".

Leonidas-from-XIV avatar Mar 20 '24 08:03 Leonidas-from-XIV