Installing utop (an OCaml tool) in NixOS


Hello! I’m learning OCaml. I wish to install utop in my NixOS laptop. I can’t install utop using OPAM. Although I can install OPAM, OCaml, and utop using the nix-env -i command. However, when I ran utop after the installation, the following error occur:

Fatal error: cannot load shared library dllunix
Reason: /nix/store/dq32s5am6fdx793zl3696zfvminincv1-ocaml-4.03.0/lib/ocaml/stublibs/ undefined symbol: caml_string_is_c_safe

I’ve run eval opam config env in the shell I ran the utop command as suggested in the Real World OCaml installation instructions but still got the same error. I tried searching for solutions but I haven’t got one so far.

Thank you in advance!

Update: I got an older version of utop running after installing jbuilder with Nix. Still can’t do much with it because I can’t get utop to open the Base library.

More update: I’m going to clean up my Nix and attempt to install everything using OPAM. I will update more detailed error messages etc as I go along.


Have you had a look at this Github issue?