Open mlemerre opened 9 months ago
It is, unfortunately, the expected result.
To resolve Z.one
, ocp-index
looks up the .cmt
and .cmti
files available in the current setting that match the query. It finds /path/to/opam/switch/lib/zarith/z.cmti
, which is more or less a marshalled version of the typed AST for z.mli
, including locations. But since z.cmti
was generated during installation of zarith
, by compiling the file z.mli
in the temporary build folder /path/to/opam/switch/.opam-switch/build/zarith.version/
, that is the location stored in the AST, and the only one that ocp_index
can report.
Note that ocp-index
does not try to read or find source files, so the existence of a z.mli
file in the library directory has no impact on what the tool will report.
One possible workaround is to keep build directories when installing opam packages (either by passing the -b
or --keep-build-dir
flag, or setting the environment variable OPAMKEEPBUILDDIR
to 'true'
). This will ensure that the locations stored inside the installed cmti files still exist.
Finally, if you have a copy of the zarith sources somewhere (through opam source
, for example) you can ask opam
to install the zarith package from these sources and use the source directory to build, which will increase the chance of ocp-index
finding the right source files. The command would look like (cd /path/to/zarith/sources && opam install . --inplace-build)
.
Hi,
First, thank you for ocp-index. I don't know why I did not know the tool before, it should definitively be part of the tools officially recommended!
One issue though is that it does not return the correct locations. If I type:
this is incorrect.
If I look at the doc, the location where z.mli is looked up is obtained by
opam var lib
, whose value isin my case.
And indeed, if I do
Then there is no result.
So my guess is that there is some changes in the path done by ocp-index, which should return instead
or
Is there something wrong in my setup? I only did opam install ocp-index.
Thanks Matthieu