Previous week Up Next week


Here is the latest OCaml Weekly News, for the week of June 02 to 09, 2015.

  1. Ocf 0.1.0 Loading and storing configuration options in JSON syntax
  2. OCaml release roadmap
  3. Can't build a target with C stubs using ocamlbuild
  4. RISC-V backend for the native-code OCaml compiler
  5. Other OCaml News

Ocf 0.1.0 Loading and storing configuration options in JSON syntax


Maxence Guesdon announced:
I'm glad to announce the first release of OCf, a library to define
configuration options and to load and store them from and to JSON.

See the documentation page for an overview:

A ppx extension is also provided to easily load and store record

Ocf should be available soon in opam.

OCaml release roadmap


Continuing this thread, Richard Jones asked and Damien Doligez replied:
> Will there be implications for C bindings?  We have rather a lot ...

There will be implications, the most obvious being that the `Field`
macro will stop being an l-value so you'll have to rewrite your uses
of caml_modify and caml_initialize:

  caml_modify(&Field(v, idx), w) => caml_modify_field(v, idx, w)
  caml_initialize(&Field(v, idx, w) => caml_initialize_field(v, idx, w)

See for more details.

I'm sure there will be other changes needed to accomodate multicore.

But we are planning to keep the sequential runtime alongside the
parallel one, at least for some time, so if you're not in a hurry to
use multicore, you'll have plenty of time to update your bindings.

Can't build a target with C stubs using ocamlbuild


Deep in this thread, Christiano Haesbaert asked and Gabriel Scherer replied:
> What is the common workflow to test such diff ?
> Is there a way to pin the compiler in opam ?

My personal workflow is to use my script
which creates an opam switch from a compiler directory, using the
compiler version and git branch name to choose the switch name.

Steps are:
- install the opam-compiler-conf script in your $PATH *outside* opam
(otherwise you will need to install it in all switches, pain)
- clone the compiler somewhere (and go to the branch you want to test)
- apply the patch you want to test
- opam compiler-conf configure (instead of "./configure" as suggested by README)
- make world.opt
- opam compiler-conf install (instead of "make install" as suggested by README)

This will create a switch with the compiler you installed named, for
example, 4.02.2+local-git-4.02 (more generally
$OCAMLVER+local-git-$BRANCHNAME). You can install opam packages and
test them as in any switch.

Then, if you modify the compiler again and make world.opt again, you can use
- make install
  from the compiler directory to install the compiler without
reinstalling the OPAM packages (if the binary interface didn't change
and recompilation is not needed)
- opam compiler-conf reinstall
  to also recompile all the OPAM packages of the script

(Another common way to get a switch: pull-request made against
github/ocaml/ocaml automatically create a corresponding switch.)

RISC-V backend for the native-code OCaml compiler


Nicolas Ojeda Bar announced:
I am happy two announce an ALPHA release of a new native-code backend
for the OCaml compiler.

It targets the RISC-V instruction set ( being
developed at UC Berkeley.  The lowRISC project at the University of
Cambridge ( is developing open-source SoCs
based on this instruction set.

This release is in the form of a cross-compiler.  It depends on the
cross-compiling support recently added to 4.02.0+trunk.  It outputs
ELF binaries that can be simulated directly on the RISC-V ISA
simulator (spike) or run natively in a suitable virtual machine.

For detailed installation instructions, please visit:

The new backend is based on the old 3.12 MIPS backend and the
currently shipping arm64 backend.  Most compiler tests that can
compile in the RISC-V environment pass successfully (including the
"big" ones such as misc-bk, misc/hamming, misc/boyer, misc/nucleic,
misc/bdd, etc.).

Limitations (some are due to the state of RISC-V software tools, some
are due to limitations of the cross-compiling support in the current
OCaml compiler, some just need work):

- Only 64-bit for now (in particular the host has to be 64-bit as well)
- Unix module is not yet supported
- The current version uses the Newlib C library, which is somewhat
less capable than glibc.
- Shared library support may or may not work (has not been tested)

Planned short term improvements (patches welcome!):

- 32-bit support
- cfi directives (and/or frame pointer inclusion) for easier debugging
- switch to glibc
- soft float support
- Unix support

Development is ongoing.

Suggestions, questions of any kind very welcome!

Other OCaml News

From the ocamlcore planet blog:
Thanks to Alp Mestan, we now include in the OCaml Weekly News the links to the
recent posts from the ocamlcore planet blog at

Aesthetic Integration joins the Caml Consortium:

Third alpha version:

Run length encoding data compression method:

Signing the OPAM repository:

Old cwn

If you happen to miss a CWN, you can send me a message and I'll mail it to you, or go take a look at the archive or the RSS feed of the archives.

If you also wish to receive it every week by mail, you may subscribe online.

Alan Schmitt