Skip to content

opam env does not set OCAMLPATH #6388

Open
@Frigory33

Description

My system is Manjaro. A lot of packages fail to install in switches other than the default one, for instance menhir or js_of_ocaml-ocamlbuild, with errors such as:

#=== ERROR while compiling js_of_ocaml-ocamlbuild.5.0 =========================#
# context     2.3.0 | linux/x86_64 | ocaml-base-compiler.5.2.1 | https://opam.ocaml.org#d87296a7b656d47b7042e7e608a5fa863b3a51f9
# path        ~/.opam/ocaml-base-compiler.5.2.1/.opam-switch/build/js_of_ocaml-ocamlbuild.5.0
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p js_of_ocaml-ocamlbuild -j 3 --promote-install-files=false @install
# exit-code   1
# env-file    ~/.opam/log/js_of_ocaml-ocamlbuild-38916-d17c67.env
# output-file ~/.opam/log/js_of_ocaml-ocamlbuild-38916-d17c67.out
### output ###
# (cd _build/default && /home/frigory/.opam/ocaml-base-compiler.5.2.1/bin/ocamlc.opt -w -40 -g -bin-annot -bin-annot-occurrences -I .ocamlbuild_js_of_ocaml.objs/byte -I /home/frigory/.opam/default/lib/ocamlbuild -I /home/frigory/.opam/ocaml-base-compiler.5.2.1/lib/ocaml/str -I /home/frigory/.opam/ocaml-base-compiler.5.2.1/lib/ocaml/unix -no-alias-deps -o .ocamlbuild_js_of_ocaml.objs/byte/ocamlb[...]
# File "ocamlbuild_js_of_ocaml.mli", line 1:
# Error: "/home/frigory/.opam/default/lib/ocamlbuild/ocamlbuild_plugin.cmi"
#        is not a compiled interface for this version of OCaml.
# It seems to be for a newer version of OCaml.

As you can see, it looks like some files are looked for in the default opam switch. There is -I /home/frigory/.opam/default/lib/ocamlbuild in the compilation command. With menhir, I have -I /home/frigory/.opam/default/lib/menhirLib -I /home/frigory/.opam/default/lib/menhirSdk.

Where does this problem come from? I don’t get those errors on Windows: my opam switches work on Windows. But I’m getting this error on my 2 Manjaro systems (which are not in sync).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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