- install a system compiler and ocamlfind (including findlib dev files, eg
libfindlib-ocaml-dev for debian)
- create a opam switch using ocaml-system,
eval $(opam env)
opam install ocamlfind
ocamlfind query findlib
It will say /usr/lib/x86_64-linux-gnu/ocaml/5.3.0/findlib (or whatever the system path on your os is) instead of /path/to/opam/lib/findlib.
Consequently, programs linking findlib will link the system findlib, and so will not find any opam-installed packages.
For instance opam install rocq-core will fail (eg rocq-prover/rocq#20546).
Considering
|
if [ "$ocaml_major" -ge 5 ]; then |
|
# OCaml 5.0+ installs its own META files under the stdlib directory. |
|
# If findlib has been configured -sitelib $(ocamlc -where) then there's |
|
# nothing to do, but otherwise we need to put OCaml's Standard Library |
|
# into the path setting. |
|
if [ ! -e "${ocaml_sitelib}/stdlib.cmi" ]; then |
|
ocamlpath="${ocaml_core_stdlib}${path_sep}${ocamlpath}" |
|
fi |
|
fi |
it's possible that this bug only happens with ocaml 5+.
The fix may be as simple as switching the order of paths ie
- ocamlpath="${ocaml_core_stdlib}${path_sep}${ocamlpath}"
+ ocamlpath="${ocamlpath}${path_sep}${ocaml_core_stdlib}"
but IDK if there are any problems with doing that.
libfindlib-ocaml-devfor debian)eval $(opam env)opam install ocamlfindocamlfind query findlibIt will say
/usr/lib/x86_64-linux-gnu/ocaml/5.3.0/findlib(or whatever the system path on your os is) instead of/path/to/opam/lib/findlib.Consequently, programs linking findlib will link the system findlib, and so will not find any opam-installed packages.
For instance
opam install rocq-corewill fail (eg rocq-prover/rocq#20546).Considering
ocamlfind/configure
Lines 302 to 310 in bd9aad1
The fix may be as simple as switching the order of paths ie
but IDK if there are any problems with doing that.