I am having difficulties running OCaml with
str.cma from the environment constructed by the toolbox. Specifically, I have created a configuration without any additional build inputs, and where I overrode Coq to 8.17+rc1. After running
nix-shell, I tried running
$ ocaml str.cma
and I get the following error:
Cannot load required shared library dllcamlstr. Reason: /home/arthur/.opam/coq-8.13/lib/ocaml/stublibs/dllcamlstr.so: /home/arthur/.opam/coq-8.13/lib/ocaml/stublibs/dllcamlstr.so: undefined symbol: caml_local_roots.
(I am a bit puzzled as to why it is trying to look into this OPAM directory... Shouldn't it avoid doing so when I enter the Nix shell?)
I am getting similar errors if I try to compile some file that uses
str.cma and then try to execute it.
Any ideas on what could be going wrong here?
This is probably because OCaml is not in PATH.
Nix only puts in PATH / scope what you ask for explicitly.
I would have to learn more about how you define your environment to be able to help.
I figured it out: I just had to invoke
nix-shell with the
--pure flag to avoid polluting its environment with flags set by OPAM.
Arthur Azevedo de Amorim has marked this topic as resolved.
Last updated: Jun 11 2023 at 00:30 UTC