[opam-devel] [MirageOS-devel] Cross-compiling OCaml, Mirage OS for rumprun, OPAM integration

Martin Lucina martin at lucina.net
Wed May 20 11:02:20 BST 2015


On Tuesday, 19.05.2015 at 15:58, Martin Lucina wrote:
> > >E: Failure("Expected built file '_build/src/unix/dlllwt-unix_stubs.so'
> > >doesn't exist.")
> > >
> > >This is expected; the rumprun toolchain does not support dynamic
> > >linking
> > >and I have configured the ocaml-rumprun compiler with
> > >-no-shared-libs. Is
> > >there some way to tell OASIS to not expect any shared libraries to be
> > >built?
> > 
> > Nope. OASIS is painfully inflexible, especially when cross-compiling.
> > You can probably patch setup.ml so that it thinks that the current
> > OCaml is built without dynlink, but this is package-specific.
> 
> Turns out it's a two-line patch, at least in the case of Lwt:
> 
> https://github.com/mato/opam-rumprun/commit/3d3a9f0b46a21370c7b619e14cbfddec90acf433

Getting further through the list of Mirage dependencies, trying to get
sexplib building for rumprun hits another different problem with OASIS:

I use the following commands to build sexplib-rumprun, similar to what the
android build does:

  ["ocaml" "setup.ml" "-configure" "--prefix" "${prefix}/x86_64-rumprun-netbsd" "--disable-syntax"]
  ["ocamlbuild" "-use-ocamlfind" "-just-plugin"]
  ["env" "OCAMLFIND_TOOLCHAIN=rumprun" "ocaml" "setup.ml" "-build"]
  ["env" "OCAMLFIND_TOOLCHAIN=rumprun" "ocaml" "setup.ml" "-install"]
  ["find" sexplib:lib "-name" "pa_sexp_conv.*" "-exec" "ln" "-sf" "{}" "%{prefix}%/x86_64-rumprun-netbsd/lib/sexplib/" ";"] { type_conv-rumprun:installed }

Now, sexplib tries to build a .cmxs which won't work with the rumprun
toolchain, so I've patched its setup.ml to force native_dynlink to be
false:

https://github.com/mato/opam-rumprun/blob/master/packages/sexplib-rumprun.112.24.01/files/patches/oasis-disable-dynlink.patch

The problem I'm seeing is that if I run "opam install sexplib-rumprun
--verbose", it fails in the setup.ml -install setup with a stack overflow:

- Installed /home/mato/.opam/system/x86_64-rumprun-netbsd/lib/sexplib_unix/sexplib_unix.cmx
- Installed /home/mato/.opam/system/x86_64-rumprun-netbsd/lib/sexplib_unix/META
- E: Stack overflow
[ERROR] The compilation of sexplib-rumprun failed at "env
        OCAMLFIND_TOOLCHAIN=rumprun ocaml setup.ml -install".

However: If I run the OPAM build commands from a shell in the build
directory for sexplib, the install step works fine.

Any ideas?

Martin


More information about the opam-devel mailing list