Skip to content

V4 musl parity: Linux_x86_musl and Linux_arm64_musl (4.0.0) - #4

Merged
jonahbeckford merged 4 commits into
mainfrom
musl-parity-4.0.0
Aug 3, 2026
Merged

V4 musl parity: Linux_x86_musl and Linux_arm64_musl (4.0.0)#4
jonahbeckford merged 4 commits into
mainfrom
musl-parity-4.0.0

Conversation

@jonahbeckford

Copy link
Copy Markdown
Contributor

What

Extends the V4 ABI enumeration with the two missing musl variants —
Linux_x86_musl (32-bit x86) and Linux_arm64_musl (aarch64) — so musl has
parity with glibc across all three Linux architectures that already have a
glibc ABI, and releases it as 4.0.0.

Why 4.0.0 (not 3.4.0)

The V4 module first shipped in the 3.3.0 git tag, breaking this repo's
convention that interface module V<n> ships in opam major version n
(V2↔2.0.0, V3↔3.0.0). 3.3.0 was never published to opam (opam has
2.0.0, 3.0.0, 3.2.0), so V4 can be finalized in place and released as 4.0.0
without breaking any opam consumer. The 3.3.0 git tag is kept as history and
annotated as superseded in CHANGES.md.

Changes

  • C header (dkml_compiler_probe.h): the <features.h> / __GLIBC__
    musl test is hoisted to cover all Linux arms; the __aarch64__ and
    __i386__ arms now split glibc vs musl (new DKML_ABI_linux_arm64_musl /
    DKML_ABI_linux_x86_musl macros).
  • discover.ml: new get_osinfo arms; adjust_pre_v4_abi degrades the
    new ABIs to Linux_arm64 / Linux_x86 in V1–V3 (matching the existing
    Linux_x86_64_muslLinux_x86_64 behavior). In V1 the degraded Linux_x86
    then hits the pre-existing Result.error, since V1 never had Linux_x86.
    The unused top-level type t_abi is removed.
  • C_conf.load now uses V4 (was V3): musl hosts read ABI-specific env
    vars like CP_GMP_CC_DEFAULT_LINUX_X86_64_MUSL. glibc/Windows/macOS hosts
    are unchanged.
  • CI: new musl.yml (Alpine/Debian × x86_64/x86/arm64 header probe, plus
    a full OCaml build/test on Alpine musl x86_64). test.yml modernized
    (retired macos-12 → ubuntu QEMU BSD VMs, action pins bumped,
    pull_request trigger); the rotted setup-dkml jobs are removed pending
    re-integration with dkml-workflows v1+.

⚠️ Breaking vs the unpublished 3.3.0 tag

V4.t_abi stays alphabetical, so the two insertions shift the ranks of later
constructors. Anything that marshalled V4.t_abi values from a 3.3.0 build
should be rebuilt. No opam release is affected.

Testing

Locally validated in Docker with the exact images musl.yml uses — all three
musl ABIs and all three glibc ABIs report correctly (Alpine/Debian ×
amd64/386/arm64), and the full OCaml toolchain on Alpine musl reports
Ok Linux_x86_64_musl end to end. Windows local dune build/runtest/README
regeneration green. GitHub Actions on this PR provides the authoritative run.

Known gap: Linux arm32 (arm32v6/arm32v7) still has no musl variant.

@jonahbeckford jonahbeckford reopened this Aug 3, 2026
@jonahbeckford
jonahbeckford force-pushed the musl-parity-4.0.0 branch 6 times, most recently from 08a4379 to 688fbb1 Compare August 3, 2026 18:38
Linux x86 (32-bit) and arm64 hosts with a musl libc need ABIs distinct
from their glibc forms, for the same reason Linux_x86_64_musl was
introduced: fully static musl builds need their own distribution slot.

+ replicate the <features.h> / __GLIBC__ musl test in the __i386__ and
  __aarch64__ branches of the C header, hoisting the include so one
  test covers all the Linux arms
+ add Linux_x86_musl and Linux_arm64_musl to module V4
+ degrade the new ABIs to Linux_x86 / Linux_arm64 in V1-V3; in V1 an
  x86 musl host then gets the pre-existing Result.error since V1 never
  had Linux_x86
+ make C_conf.load use V4 so musl hosts read ABI-specific environment
  variables like CP_GMP_CC_DEFAULT_LINUX_X86_64_MUSL
+ delete the unused top-level t_abi in discover.ml

Signed-off-by: Jonah Beckford <9566106-jonahbeckford@users.noreply.gitlab.com>
The workflow had rotted (macos-12 retired, actions/*-artifact@v3
disabled) and its actions were not on this repository's curated Actions
allowlist, so every run failed at startup once Actions was enabled. It
also had no musl coverage at all. Rebuild it as one workflow with four
jobs:

+ c-header-probe: compile the C header on musl (Alpine) and glibc
  (Debian) for x86_64 / x86 / arm64 and assert DKML_ABI and its
  companion define. Uses only `docker run` (+ actions/checkout);
  arm64 emulation is registered with `docker run tonistiigi/binfmt`
  rather than a non-allowlisted setup-qemu action
+ ocaml-alpine-musl: the full dune-configurator -> c_abi.ml path on a
  real musl host, asserting Ok Linux_x86_64_musl
+ Cross-Platform-Action: FreeBSD 14.2 and OpenBSD 7.6 guests via
  cross-platform-actions v1.3.0 (SHA-pinned). Install ocaml + opam +
  git + ocamlfind from the BSD packages and use the packaged OCaml via
  ocaml-system after an opam update, so nothing is compiled from source
  in the emulated VM. `ocaml` reading a script on stdin exits 0 even on
  a toplevel error, so grep the output for the expected Ok <abi> rather
  than trusting the exit code
+ test-with-setup-ocaml: Windows/macOS/Linux glibc on ocaml/setup-ocaml
  (SHA-pinned, OCaml 4.14.x), replacing the former DkML MSVC/MSYS2 +
  manylinux reusable-workflow matrix whose actions are not allowlisted

Triggers add pull_request and workflow_dispatch alongside push to main.

Signed-off-by: Jonah Beckford <9566106-jonahbeckford@users.noreply.gitlab.com>
The markdown-link-check and shellcheck actions were referenced by
floating tags (@v1, @master) that are not on the repository's curated
Actions allowlist, so the workflow failed at startup once Actions was
enabled.

+ pin gaurav-nelson/github-action-markdown-link-check to v1.0.17 (SHA)
+ pin ludeeus/action-shellcheck to v2.0.0 (SHA)
+ bump actions/checkout from @master to the allowlisted @v6

Signed-off-by: Jonah Beckford <9566106-jonahbeckford@users.noreply.gitlab.com>
`dune build @runtest @runmarkdown --auto-promote`

An interface module V<n> ships in opam major version n: V4 belongs to
4.0.0, restoring the correspondence broken when the 3.3.0 tag shipped
V4 under a 3.x version. 3.3.0 was never published to opam and is
superseded by this release.

Signed-off-by: Jonah Beckford <9566106-jonahbeckford@users.noreply.gitlab.com>

@jonahbeckford jonahbeckford left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ltgm

@jonahbeckford
jonahbeckford merged commit 7cc89ed into main Aug 3, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant