Stream: Coq devs & plugin devs

Topic: ✔ Installing coq-stdlib with opam


view this post on Zulip Ali Caglayan (Apr 03 2023 at 21:30):

I'm not setting environment variables by hand. All the correct ocaml env vars should be setup by opam since I am creating a brand new switch. In order to use opam, you need a global install of ocaml. I get opam and ocaml from nixpkgs which is why there are some funny env vars like OCAMLFIND_DESTDIR. Even if these are unset, opam fails to build coq-stdlib due to the way plugins are detected. The fact that I am on NixOS shouldn't really be relevent here as it shouldn't impede the functionality of opam which all happens inside a .opam folder anyway.

view this post on Zulip Ali Caglayan (Apr 03 2023 at 21:31):

My guess I have another lingering env var related to findlib which is preventing findlib in Coq from finding the plugins correctly. Not sure what it is.

view this post on Zulip Gaëtan Gilbert (Apr 03 2023 at 21:33):

if you install just coq-core does ocamlfind find the plugins?

view this post on Zulip Ali Caglayan (Apr 03 2023 at 21:35):

OK I found the issue.

view this post on Zulip Ali Caglayan (Apr 03 2023 at 21:35):

I had OCAMLPATH set before doing opam switch create

view this post on Zulip Ali Caglayan (Apr 03 2023 at 21:35):

I thought that opam sandboxed these env vars especiallly ones that it actually uses but apparently not.

view this post on Zulip Ali Caglayan (Apr 03 2023 at 21:37):

I guess we should document somewhere that coq-stdlib cannot be installed if OCAMLPATH has been set externally. Or at least coq-core should be installed and then eval $(opam env) done and then the stdlib.

view this post on Zulip Notification Bot (Apr 03 2023 at 21:37):

Ali Caglayan has marked this topic as resolved.

view this post on Zulip Ali Caglayan (Apr 03 2023 at 21:39):

I'll open a PR

view this post on Zulip Emilio Jesús Gallego Arias (Apr 03 2023 at 21:59):

Yes, I was going to say "I bet your OCAMLPATH is funny due to Nix"

view this post on Zulip Emilio Jesús Gallego Arias (Apr 03 2023 at 21:59):

because that failure is indeed coq-stdlib not finding where the Coq OCaml libs are, and all that the build script does is to call ocamlfind

view this post on Zulip Ali Caglayan (Apr 03 2023 at 22:01):

Is there a way for opam to not use the externally given evn var?

view this post on Zulip Emilio Jesús Gallego Arias (Apr 03 2023 at 22:01):

Maybe ask on #opam 's Slack?

view this post on Zulip Théo Zimmermann (Apr 04 2023 at 08:19):

AFAICT, you do not need a global OCaml install to use opam. I have opam installed on NixOS but not OCaml and it works (as long as I do nix-shell -p binutils before creating a new switch, which will build an OCaml compiler anyway).

view this post on Zulip Paolo Giarrusso (Apr 04 2023 at 10:24):

I can confirm you don't need one; the only downside is that each opam switch will rebuild the compiler, but that takes a couple minutes


Last updated: Nov 29 2023 at 21:01 UTC