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

**URL:** <https://discuss.ocaml.org/t/ann-setup-dkml-yml-github-actions-workflow-for-distributing-binaries/10308>\
**Category:** Ecosystem\
**Tags:** dkml, announce\
**Created:** [August 14, 2022, 2:55am UTC](https://discuss.ocaml.org/t/ann-setup-dkml-yml-github-actions-workflow-for-distributing-binaries/10308 "2022-08-14T02:55:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbeckford](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/jbeckford/32/3027_2.png) [@jbeckford](https://discuss.ocaml.org/u/jbeckford)\
**Post date:** [August 14, 2022, 2:55am UTC](https://discuss.ocaml.org/t/ann-setup-dkml-yml-github-actions-workflow-for-distributing-binaries/10308/1 "2022-08-14T02:55:24Z")

</div>

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

- [https://github.com/diskuv/dkml-workflows#readme](https://github.com/diskuv/dkml-workflows#readme)

It is similar to the [GitHub Action setup-ocaml](https://github.com/marketplace/actions/set-up-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](https://github.com/ocamllabs/opam-monorepo#readme) 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](https://www.msys2.org/) on Windows, and coverage for an older GLIBC on Linux.

The full comparison matrix available at [https://github.com/diskuv/dkml-workflows#readme](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](https://gmplib.org/manual/Copying) |
| 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)](https://ocaml-sf.org/) for their support of DKML. Enjoy!

---

<div class="post-metadata">

**Author:** ![jbeckford](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/jbeckford/32/3027_2.png) [@jbeckford](https://discuss.ocaml.org/u/jbeckford)\
**Post date:** [November 7, 2022, 9:51pm UTC](https://discuss.ocaml.org/t/ann-setup-dkml-yml-github-actions-workflow-for-distributing-binaries/10308/2 "2022-11-07T21:51:54Z")

</div>

There is a new major version 1.1.0 available. It is not backwards-compatible but it adds:

- Supports GitLab CI/CD in addition to GitHub Actions
- Supports testing/troubleshooting/developing your CI on your desktop (macOS, Linux if you have Docker, and Windows if you have Visual Studio). You do _not_ need DKML installed on your machine.

The only known issue is that GitLab CI/CD sometimes kills the Windows build of the OCaml compiler when using the shared GitLab SaaS runner; retrying the job usually fixes that.

If you had used the `v0` series of the workflow, that version will continue to be supported for a few months but won’t get any updates unless the update is critical.

> **[GitHub - diskuv/dkml-workflows: GitLab CI/CD and GitHub Action workflows used...](https://github.com/diskuv/dkml-workflows#readme)**
>
> GitLab CI/CD and GitHub Action workflows used by and with Diskuv OCaml (DKML) tooling. - GitHub - diskuv/dkml-workflows: GitLab CI/CD and GitHub Action workflows used by and with Diskuv OCaml (DKML...

_Upgrading?_ The most straightforward way is to introduce `1.1.0` into your project (see the link above) and only after it is working you should remove the `v0` GitHub child workflow.
