Porting OCaml to Unusual Platforms (HP-UX, AIX, etc.)

OCaml is well-tested on most popular platforms, such as the x86 and Arm families, but some other supported platforms (s390x, sparc) have been less tested, at least recently. For even less popular platforms, support has either been removed since 4.00.0 (IA64, HPPA, MIPS) or never added. If you want to use OCaml on such platforms, you have to either limit yourself to bytecode… or contact OCamlPro to port OCaml to that platform !

A Case Study: OCaml on IA64-HPUX

OCaml 3.12.1 used to target HPPA-HPUX and IA64-Linux, but support for these platforms was removed in 4.00.0. Recently, we were contacted by a company who needed to run their software on IA64-HPUX. OCaml had never ran on such a platform, but we were confident that we could resurrect the old IA64 backend of OCaml 3.12.1, and adapt it to HPUX.

Accessing the Hardware

One of the main challenges with unpopular platforms is to get access to the hardware. In the case of IA64-HPUX, we finally found that the most simple solution was to rent a VM in the cloud, a solution that we were lucky to find possible for that platform. The VM provided only a basic set of commands, so the first thing we had to do was to install some usual development tools, such as gcc, emacs, etc.

Compiling OCaml

The funny thing with HPUX is that nothing runs there as usual: even running the OCaml testsuite would trigger many errors, that were caused, not by OCaml itself, but by specific behaviors of traditionnal Unix commands, such as /bin/sh, grep, diff, and so on. So, after a few fixes in the configuration of OCaml, we got a bytecode version running, but we had to spend most of our time fixing problems in the Makefiles of the testsuite to get reliable results. Finally, most of the tests would pass in bytecode, although we had to fix some silent errors in the C code for all of them to work.

Getting native code support was much more work: we first tried to compile OCaml 3.12.1, who already had support for IA64, but we found out that the IA64 backend would not work in a straightforward way on IA64-HPUX. We also found a few bugs in the generated code, that backend was probably much less tested than the other backends. Finally, we had native code running and passing most of the testsuite, with only a few restrictions: no support for dynamic linking of native code, no stack-overflow detection and functions limited to at most 31 arguments.

To switch to the 4.0+ versions, we had to plug our new 3.12.1 backend into the new versions. It required a lot of plumbing, but it was reasonable, even if we wished that the code of the compiler was more commented ! We finally also spent some time implementing backtraces in native code, a feature that we think is important for debugging OCaml applications. It was also a nice opportunity to write IA64 assembly, to enjoy manual parallelization and dependency analysis on our code ! At the end, we were quite pleased to see the testsuite passing on all versions, including 4.05.0+beta3.

OCaml on IA64-HPUX

We have versions 3.12.1, 4.03.0, 4.04.0 and 4.05.0+beta3, in both bytecode and native code, with only a few limitations in native code: no stack-overflow detection, no dynamic linking, functions limited to 31 arguments. For all of these versions, we archived both the sources, and binary distributions that we would be able to install in the /opt directory, to have OCaml running in seconds in new instances.

You need OCaml on an Unusual Platform ?

If you need to run OCaml software on platforms that are less popular than the x86/arm linuxes, windows and macos, just contact us !

What can we do for you ?

Resurrect former backends of OCaml, as shown in this case study;

Port OCaml to new architectures, possibly upstreaming the backend to OCaml, if the core-team is ok;

Provide assistance while you are porting your OCaml software to these platforms;

Provide Long Term Support (LTS) for the specific platforms that matter for you, by porting new OCaml versions in a timely manner.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.