fix: odoc driver linking to stdlib in $prefix/lib64 - #1474
Conversation
As of about 2 years ago, ocamlfind is able to automatically infer the config path from opam environment variables: https://github.com/ocaml/ocamlfind/blob/be2335f14cc45b5551dea4278affdfb2718eb72e/src/findlib/findlib_config.mlp#L71-L77 This removes the explicitly provided arguments and will be more reliable than hardcoding a subpath of the opam prefix. Also, hardcoding the `env_camllib` can be risky because it's not portable. On openSUSE Tumbleweed, my stdlib was actually in `{prefix}/lib64` rather than the `lib/ocaml` which was hardcoded.
|
Thanks! I just put 'no changelog required' on this PR, but thinking about it, it's fixing a real bug that you found and that others might too - in which case it'd be useful to create an issue then have a changelog referencing it. Could you do that please? |
|
Looking at the commit that added it the code is only available in ocamlfind >= 1.9.8, so I think it requires some updates to the lower bounds in odoc. |
|
Thanks! Added and updated the changelog, let me know if that looks okay. I do also still intend to file the issue, as Jon suggested. I just wanted to double-check some things first and I'm away from the relevant computer right now. |
$prefix/lib64
- Fix odoc_driver's detection of `stdlib` when it is in `$prefix/lib64`, requires ocamlfind >= 1.9.8
|
@jonludlam I've filed the issue and incorporated another small change which was needed to fully fix the issue :) Let me know how it looks. |
This does two related changes to fix #1477:
lib64/and also accept files appearing outside of a package subdirectory, as the ocaml stdlib files do.I can test that it works with
dune exec odoc_driver -- fmt.Removing the explicitly provided arguments to findlib will be more reliable than hardcoding a subpath of the opam prefix.
As of about 2 years ago, ocamlfind is able to automatically infer the config path from opam environment variables: https://github.com/ocaml/ocamlfind/blob/be2335f14cc45b5551dea4278affdfb2718eb72e/src/findlib/findlib_config.mlp#L71-L77
Also, hardcoding the
env_camllibcan be risky because it's not portable or overridable. On openSUSE Tumbleweed, my stdlib was actually in{prefix}/lib64rather than thelib/ocamlwhich was hardcoded.Findlib also has logic to let the user override the paths using environment variables, if needed: https://github.com/ocaml/ocamlfind/blob/be2335f14cc45b5551dea4278affdfb2718eb72e/src/findlib/findlib.ml#L281-L289