[opam-devel] mirage, opam and cross-compiling... ?

Christopher Greenhalgh Chris.Greenhalgh at nottingham.ac.uk
Thu Sep 19 09:55:55 BST 2013

On 18 September 2013 16:58 Anil Madhavapeddy wrote:

>- there's no standard for specifying an equivalent to CFLAGS/CC in OCaml build systems -- everyone defines their own.

I did some thinking about (something that turned out to be equivalent to) this and I came up with what - to me - seems like a sensible scheme; for posterity I've noted it here: https://github.com/cgreenhalgh/ocaml-crosscompiling/blob/master/docs/toolchainproposal.md 
but probably it should be fed somewhere else as it would involve a new flag in all the ocaml commands...

>- the annoying ones are usually syntax extensions, which need to be built as host libraries and not target libraries.  We have a way to sidestep this as of a few weeks ago.  Leo White has built a specialized compiler driver that bypasses the usual compiler parse tree, and instead statically links in some camlp4 extensions.  This is not only faster, but it avoids dynamic linking in the compiler completely!  Most of our syntax extension requirements are actually pretty minimal (the Lwt one, and perhaps Sexplib and Cow), so we could just link those into one mega-compiler-driver that works on all the source code that we care about.

With and ocaml-android cross-compiler this seems to have 'just worked' so far, presumably because it is using the syntax extensions as bytecode only and they have no dependencies on native libraries. (I haven't dug enough to see exactly what is going on yet). Potentially fragile, though...

p.s.  I've left a link but moved my notes to a new git repo, https://github.com/cgreenhalgh/ocaml-crosscompiling )


This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system, you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.

More information about the opam-devel mailing list