Mirage OS: Building from source



I bought Real World OCaml and have programmed functionally in scala.

I want to setup a local dev, compile mirage and then use that in *mirage-skeleton to study its working.

I tried looking at https://github.com/mirage/mirage and wanted to compile mirage from source but it doesn’t provide much info.

I looked at mirage.io and devel-lists but don’t find much info.

I am looking at travis logs to setup a local dev.

Can any suggest links to see the same ?


Never mind, i got it to compile and ran it.

I ran it in ArchLinux perpetual version

  1. git clone [https://github.com/mirage/mirage]
  2. cd mirage
  3. make
  4. opam install

fmt cstruct ipaddr functoria functoria-runtime astring

mirage-device mirage-flow mirage-protocols mirage-stack mirage-kv mirage-fs mirage-channel mirage-console mirage-block mirage-clock mirage-net mirage-time mirate-random mirage-protocols-lwt mirage-stack-lwt mirage-channel-lwt mirage-net-lwt mirage-kv-lwt mirage-fs-lwt mirage-console-lwt mirage-block-lwt mirage-clock-lwt mirage-time-lwt mirage-runtime

The native binary is located in _build/lib/mirage_cli.native


Hi @indykish, I’m glad you got it working!

I’m curious why you didn’t want to install via opam. It still installs via source but will manage dependencies for you.


I would like to hack the code.

Modify, compile it and such to my need for a different purpose.:slight_smile:



You wrote opam installs via source.

But i don’t find opam command to install from my local cloned copy ? I only found a Makefile

I believe opam is like npm, scala sbt

Is there something i had missed.

Hence i didn’t go by the route of cloning mirage-skeleton and opam install mirage


for local development, I run “opam install mirage” (to get the
dependencies), you may pass --deps-only to opam to not compile mirage.

Then, you can use “opam pin add -k git mirage pwd#HEAD” which tells
opam to use your current pwd for mirage… for mirage itself this is
not needed, but if you need to modify dependencies this is the way to do
it (to have opam install local versions of libraries). See
http://opam.ocaml.org/doc/Usage.html#opampin for some documentation.

Keep in mind that opam’s default mode for paths is weird, the "-k git"
option will use git HEAD for building (thus, you’ve to commit your local
changes locally). In the default mode, where the directory is used
directly, spurious build products from manual builds may end up in
strange errors. (NOTE: opam2 has a more sane pinning mechanism IIRC)


Thanks for your valuable input. I will try that.