tweag / opam-nix

Turn opam-based OCaml projects into Nix derivations
MIT License
111 stars 33 forks source link

Handle ocaml stublibs properly #9

Closed rvem closed 2 years ago

rvem commented 2 years ago

Is your feature request related to a problem? Please describe.

Currently, opam-nix installs ocaml stublibs to $OCAMLFIND_DESTDIR/${pname} together with the rest of the libraries. However, ocaml compiler expects them to be present in $OCAMLFIND_DESTDIR/stublibs directory.

This is the case for e.g. zarith library.

Describe the solution you'd like

The following postInstall workaround seems to work:

postInstall = ''
    mkdir -p "$OCAMLFIND_DESTDIR/stublibs"
    ln -s "$OCAMLFIND_DESTDIR"/${o.pname}/dll*.so "$OCAMLFIND_DESTDIR"/stublibs/
  '';

Ideally, opam-nix should handle this automatically. Maybe there is a way to specify a place to looks for stublibs.

balsoft commented 2 years ago

opam-nix just calls make install in case of zarith, which then calls ocamlfind install. That doens't seem to install stuff correctly for some reason.

balsoft commented 2 years ago

Ok, I see. ocamlfind install will only install DLLs to stublibs if that directory exists.

balsoft commented 2 years ago

Thanks!