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

Adrien Nader adrien at notk.org
Tue May 19 19:27:23 BST 2015


Hi,

Thanks for Cc'ing me.

I'm sorry, the mail got a bit long and I'm a quite tired so if anything
isn't clear, don't hesitate to give up reading the sentence or paragraph
and ask for a clarification.


The work needed to properly support cross-compilation, including for
Windows, is bigger than what we had thought at first. Back then I was
able to find some more time but then it got clear that we had to put
things into perspective and use a new approach.

So far there's part of the infrastructure (configure for instance) but
not everything. It was never intended by me that 4.02 advertised
OOTB cross-compilation support. It was still thought that there would be
work needed by each set of people building their cross-compilers but
that at least that work would be reduced.

I was also very very reluctant to advertise it early because of the
"oh-shiny" factor: there are some hidden bugs and people rushing on
cross-compilation will mostly get them broken binaries. One example I
got was a top-level value not being initialized; think about it for a
second, it's very difficult to spot, can go unnoticed for a long time
and can have very bad consequences.

It seems that it mostly worked and not too many people tried to jump on
it.

I know Peter had some fairly good results for Android. That was
completely out of my scope and there are some heavy differences caused
by the Makefile.nt files (among others) so his setup was really simpler
than mine. Nevertheless I'd really prefer that support got more complete
before featuring cross as non-beta.

The reason these commits made it in 4.02 is that, well, back then 4.02
was still called "pre", i.e. was under development. The commits also
didn't negatively impact what was already there yet had to be merged
because the time to rebase the patch-set was longer than the time
between two needs to do it.

Currently I'm a bit overloaded with work but we're down to one week
before release at work so that should really free time. The approach I
chose now is to split things some more inside OCaml in order to be able
to actually get some progress: the current build system is very brittle.

I started http://caml.inria.fr/mantis/view.php?id=6773 which splits
apart the build of the non-compiler executables and after that, their
Makefile.nt files can be easily killed (needs some work but not much).
Once that is done, the other Makefile.nt files need to be killed and
from my short testing it'll be much simpler than it currently is. They
have been a large time sink for the cross-compilation work and should
really be removed first.

Once these are done it is a matter of going back to bug 5737, check the
patchlist and look at what's not done yet. The scope should be reduced
so much compared to when I started that I expect the changes to be much
simpler.

-- 
Adrien Nader

On Tue, May 19, 2015, Gabriel Scherer wrote:
> Indeed, this seems to be a side-effect of the partial merge of Adrien
> Nader's patches; he was working on cross-compilation in trunk between
> releases 4.01 and 4.02.
> 
> http://caml.inria.fr/mantis/view.php?id=5737
> https://github.com/ocaml/ocaml/commit/dda5f84f7c47de4cb1225de77ec723bacb06e905
> 
> On Tue, May 19, 2015 at 4:53 PM, Martin Lucina <martin at lucina.net> wrote:
> 
> > On Tuesday, 19.05.2015 at 16:48, Daniel Bünzli wrote:
> > > Le mardi, 19 mai 2015 à 16:44, Martin Lucina a écrit :
> > > > What I don't understand is why
> > > > upstream OCaml 4.02.01 claims to support cross-compilation but
> > doesn't; was
> > > > this original effort abandoned by upstream? If so, why?
> > >
> > > Where do you see that ? This is news to me. Some work is being done
> > right now [1] but I don't think anybody ever claimed there was support for
> > cross-compilation in 4.02.
> >
> > In the 4.02.1 INSTALL file[1], which documents a "-target" option and says
> > it will produce a cross-compiler.  The switch is even accepted by
> > configure, but the guts don't actually work.
> >
> > Perhaps some commit snuck in to 4.02.1 which shouldn't have?
> >
> > Martin
> >
> > [1] https://github.com/ocaml/ocaml/blob/4.02.1/INSTALL#L68
> > _______________________________________________
> > opam-devel mailing list
> > opam-devel at lists.ocaml.org
> > http://lists.ocaml.org/listinfo/opam-devel
> >


More information about the opam-devel mailing list