[ANN] setup-dkml.yml GitHub Actions workflow for distributing binaries

I am pleased to announce the v0 release of setup-dkml.yml, a GitHub Actions workflow for distributing executables or libraries to the public:

It is similar to the GitHub Action setup-ocaml but has several advantages when you are releasing a finished product to the public:

  • On Linux it uses an ancient GLIBC (C library) so your binaries run on most Linux distributions without static linking. Statically linked binaries are simple to distribute, but can be problematic for some copy-left licenses, and makes it difficult for your end-users to do security patching of the libraries you linked with.
  • On Windows it uses the Visual Studio compiler rather than the non-standard (for Windows) GCC compiler. This is a necessity when distributing Windows libraries, and reduces runtime bugs when linking native Windows libraries into your OCaml-built Windows executables. In addition you can generate Windows 32-bit binaries.
  • On macOS it can build both ARM64 and x86_64 binaries if you use opam-monorepo to build your project. Alpha-release caution: This works today but only if you hand-edit the .locked file. So only advanced users today!

Even if you are not releasing to the public, if you are a package maintainer you may want to use both setup-ocaml and setup-dkml so that you get additional coverage for Visual Studio and MSYS2 on Windows, and coverage for an older GLIBC on Linux.

The full comparison matrix available at https://github.com/diskuv/dkml-workflows#readme is:

setup-dkml setup-ocaml Consequence
dkml-base-compiler ocaml-base-compiler setup-dkml only supports 4.12.1 today. setup-ocaml supports all versions and variants of OCaml
GitHub child workflow GitHub Action setup-dkml is more complex to configure, and takes longer to run
MSVC + MSYS2 GCC + Cygwin On Windows setup-dkml can let your native code use ordinary Windows libraries without ABI conflicts. You can also distribute your executables without the license headache of redistributing or statically linking libgcc_s_seh and libstdc++
dkml-base-compiler ocaml-base-compiler On macOS, setup-dkml cross-compiles to ARM64 with dune -x darwin_arm64
CentOS 7 and Linux distros from 2014 Latest Ubuntu On Linux, setup-dkml builds with an old GLIBC. setup-dkml dynamically linked Linux executables will be highly portable as GLIBC compatibility issues should be rare, and compatible with the unmodified LGPL license used by common OCaml dependencies like GNU MP
0 yrs 4 yrs setup-ocaml is officially supported and well-tested.
Some pinned packages No packages pinned setup-dkml, for some packages, must pin the version so that cross-platform patches (especially for Windows) are available. With setup-ocaml you are free to use any version of any package
diskuv/diskuv-opam-repository fdopen/opam-repository Custom patches for Windows are sometimes needed. setup-dkml uses a much smaller set of patches. setup-ocaml uses a large but deprecated set of patches.

Put simply, use setup-dkml when you are distributing executables or libraries to the public. Use setup-ocaml for all other needs.

setup-dkml will setup the following OCaml build environments for you:

ABIs Native ocamlopt compiler supports building executables for the following operating systems:
win32-windows_x86 32-bit Windows [1] for Intel/AMD CPUs
win32-windows_x86_64 64-bit Windows [1] for Intel/AMD CPUs
macos-darwin_all 64-bit macOS for Intel and Apple Silicon CPUs. Using dune -x darwin_arm64 will cross-compile to both; otherwise defaults to Intel.
manylinux2014-linux_x86 32-bit Linux: CentOS 7, CentOS 8, Fedora 32+, Mageia 8+, openSUSE 15.3+, Photon OS 4.0+ (3.0+ with updates), Ubuntu 20.04+
manylinux2014-linux_x86_64 64-bit Linux: CentOS 7, CentOS 8, Fedora 32+, Mageia 8+, openSUSE 15.3+, Photon OS 4.0+ (3.0+ with updates), Ubuntu 20.04+

Thanks to the OCaml Software Foundation (OCSF) for their support of DKML. Enjoy!

6 Likes