Thicket thicket
cambridge
REPOS 4

Projects covers Forester, Merry, xdge and ocaml-crockford.

W40.2026 · 28 Sep – 4 Oct / Issue

Rule in forester.compiler build is not portable (OpenBSD)

tangled · jonmsterling.com/ocaml-forester · did:plc:jjiv56ot7d6sgethto3jr3r5

The following dune rule in lib/compiler/dune is calling md5sum, which is unfortunately not part of the standard OpenBSD distribution apparently. There is a user on IRC trying to build on OpenBSD and it would be nice if we can support that. I wonder if there is another way to achieve what this is doing? And actually, I am a little unsure myself of what this is doing ;-)

(rule
 (target Cache_version.ml)
 (deps
  (:types ../core/Types.ml)
  (:uri ../core/URI.ml)
  (:range ../core/Range.ml)
  (:xml_types ../xml_names/Types.ml))
 (action
  (with-stdout-to
   Cache_version.ml
   (system
    "printf 'let value = \"%s\"\\n' \"$(cat %{types} %{uri} %{range} %{xml_types} | md5sum | cut -c1-16)\""))))

Comments

did:plc:4gj3ihsdh6fn3aqq5bdnw5w3

I came up with this when implementing the json blob caching to guard against loading incompatible blobs. It creates an ocaml module

val value = <hash>

It is definitely overengineered. I will replace it with a simpler version that uses the same mechanism as the --version command.


did:plc:4gj3ihsdh6fn3aqq5bdnw5w3

This is addressed by https://tangled.org/jonmsterling.com/ocaml-forester/commit/8805c1814fdb5c7df01eb6fdf338ce13f0bb2f38. I remembered why this was necessary: Marshal.from_string does not raise an exception when the type layout is incompatible, so we need this to prevent segfaults.


did:plc:jjiv56ot7d6sgethto3jr3r5

Ha, nice solution.