I am a new OCaml user. I have asked a question to learn how to set up a basic OCaml project, but I still have issues. Jump to the end for a TL;DR
For instance, I am trying to learn Irmin. On the home page of Irmin I see I have to do
opam install irmin git cohttp
Doing so, I end up with Irmin version 0.8.3. Unfortunately, I cannot follow their examples, because apparently Irmin is at version 0.9.4, and it looks like the API has changed. So, I would like to start a clean project having as dependency just Irmin 0.9.4
First, I have set up an opam switch with
opam switch install playground -A 4.02.1
to be sure to work on a clean slate. Then, I have created a basic _oasis
file that looks like this
OASISFormat: 0.4
Name: Playground
Version: 0.1.0
Synopsis: OCaml playground
Authors: Andrea Ferretti
License: Apache-2.0
BuildTools: ocamlbuild
BuildDepends:
irmin,
irmin.unix,
lwt,
lwt.unix
and then I have copied the example from the Irmin homepage in example.ml
.
open Lwt
open Irmin_unix
let store = Irmin.basic (module Irmin_git.FS) (module Irmin.Contents.String)
let config = Irmin_git.config ~root:"/tmp/irmin/test" ~bare:true ()
let prog =
Irmin.create store config task >>= fun t ->
Irmin.update (t "Updating foo/bar") ["foo"; "bar"] "hi!" >>= fun () ->
Irmin.read_exn (t "Reading foo/bar") ["foo"; "bar"] >>= fun x ->
Printf.printf "Read: %s\n%!" x;
return_unit
let () = Lwt_main.run prog
If I do oasis setup
and then ocamlbuild example.ml
I get a bunch of errors
W: Cannot get variable ext_obj
W: Cannot get variable ext_lib
W: Cannot get variable ext_dll
W: Cannot get variable ocamlfind
So in short my question is:
What is the simplest way to set up a clean project that depends on Irmin 0.9.4, being sure that it is self-contained (it will not rely on preinstalled libraries other than those installed by the build process)?