xenopamunikernelmirage

How to build a Xen unikernel of Mirage OS


I read this document(http://openmirage.org/wiki/hello-world) and tried to build a xen unikernel as follows:

mirage configure --xen
make depend
make    

But failed at compilation:

ocamlbuild -classic-display -use-ocamlfind -pkgs lwt.syntax,mirage-console.xen,mirage-types.lwt -tags "syntax(camlp4o),annot,bin_annot,strict_sequence,principal" -tag-line "<static*.*>: -syntax(camlp4o)" -cflag -g -lflags -g,-linkpkg,-dontlink,unix main.native.o
ocamlfind ocamldep -package mirage-types.lwt -package mirage-console.xen -package lwt.syntax -syntax camlp4o -modules main.ml > main.ml.depends
ocamlfind ocamlc -c -g -annot -bin-annot -principal -strict-sequence -package mirage-types.lwt -package mirage-console.xen -package lwt.syntax -syntax camlp4o -o main.cmo main.ml
ocamlfind ocamlopt -c -g -annot -bin-annot -principal -strict-sequence -package mirage-types.lwt -package mirage-console.xen -package lwt.syntax -syntax camlp4o -o main.cmx main.ml
pkg-config --print-errors --exists mirage-xen
Package mirage-xen was not found in the pkg-config search path.
Perhaps you should add the directory containing `mirage-xen.pc'

to the PKG_CONFIG_PATH environment variable No package 'mirage-xen' found make: *** [build] Error 1

I installed mirage-xen by opam install mirage-xen successfully. But in my .opam directory, there are no mirage-xen.pc.


Solution

  • Chances are that your version of mirage-xen is out of date. You can update it via OPAM by:

    opam update -u
    opam info mirage-xen
    

    Make sure that you have mirage-xen version 2.1.1 or greater (the latest as of this comment is 2.1.3).

    If you don't pick up the upgrade, then you may have a local Git checkout of the central package database. Confirm this by looking at the output of:

    opam remote
    

    The output of this should tell you where your local git checkout is, and so navigate there and refresh from git://github.com/ocaml/opam-repository and then run opam update -u.