8000 opam-installed ocamlfind incorrectly finds system installed ocamlfind · Issue #107 · ocaml/ocamlfind · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
opam-installed ocamlfind incorrectly finds system installed ocamlfind #107
Open
@SkySkimmer

Description

@SkySkimmer
  • 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

ocamlfind/configure

Lines 302 to 310 in bd9aad1

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0