Static OCaml Binaries

When compiling OCaml files with -ccopt -static you might get the following warning:

Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

This can be fixed by the following steps:

  1. install musl (“musl-bootstrap” on VoidLinux)
  2. create a static switch: opam switch create 5.3.0+static ocaml-variants.5.3.0+options ocaml-option-static

2025-01-18