mirage / ocaml-git

Pure OCaml Git format and protocol

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: Reference to undefined global `Checkseum'

oemmerson opened this issue · comments

When trying to run the example in utop #require "git-unix";; fails as below:

utop [0]: #require "git-unix";;
Error: Reference to undefined global `Checkseum'

I am on Ocaml 4.09.0 on Linux with Git 2.1.2, and git-unix 2.1.2 installed.

The same error seems to occur on every release after 2.0.0

Yes, currently utop is not able, in anyway, to load correctly checkseum (or digestif). It's because both of these libraries use variants in the old and new way.

At this point, only dune can infer which implementation should be use to load/link the final executable like ogit-* binaries. But utop can not infer which sub-library/implementation is needed to load git into your REPL.

To fix that, you must explicitly choose which implementation you want. Currently, digestif and checkseum provide 2 implementations:

  • checkseum.c and digestif.c
  • checkseum.ocaml and digestif.ocaml

Your call of utop should be:

$ utop -require checkseum.c,digestif.c,git-unix

Note that if you want to make an executable with git-unix and dune, dune is able to resolve by itself the default implementation of checkseum and digestif (the C one). But you still able to choose one of them - specially if you want to compile with js_of_ocaml, in this case, the OCaml implementation is needed.

Perhaps the readme should be updated to precede the example with this invocation of utop?

Speaking of the README example, it also fails because module FS is unboad. Showing how that's meant to be obtained would help with onboarding.

Should be fixed with #383