fix(alpine): declare xz-dev so R can start after a clean install #10

Merged
pat-s merged 1 commit from fix/alpine-xz-runtime-dep into main 2026-09-18 07:14:18 +00:00
Owner

Motivation

Found while verifying #9 against a published artifact.
The Alpine .apk installs cleanly and then fails on every invocation, because libR.so links against liblzma but the package never declared a dependency on it:

Error loading shared library liblzma.so.5: No such file or directory
  (needed by /opt/R/4.6.1/lib/R/lib/libR.so)
Error relocating /opt/R/4.6.1/lib/R/lib/libR.so: lzma_code: symbol not found
Error relocating /opt/R/4.6.1/lib/R/lib/libR.so: lzma_stream_decoder: symbol not found

The dependency list carried # - liblzma-dev, the Debian name.
That package does not exist on Alpine, so it had been commented out rather than translated, alongside the other Debian leftovers (# - libc6, # - libgomp1, # - libx11-6).
Unlike those, this one is actually required.

Change

Replace it with xz-dev, the Alpine equivalent, which pulls xz-libs, the package that owns liblzma.so.5.
Keeping the -dev variant matches every other entry in the list, which are deliberately -dev so CRAN packages can be built from source on the target.

Applied to all five builder/package.alpine-* files.

Verification

Repackaged the currently published r-4.6.1_1_aarch64.apk with the patched dependency list, then installed it into a clean alpine:3.22 container with nothing else added:

=== depends in the repackaged apk ===
cairo g++ gcc gfortran icu-dev jpeg-dev libbz2 libcurl libdeflate-dev libpaper
libpng-dev libtirpc-dev make openblas-dev pango pcre2-dev readline-dev tcl
tiff-dev tk unzip xz-dev zip zlib-ng-dev

=== does R start with no manual extra packages? ===
OK: R version 4.6.1 (2026-06-24)

Before this change the same clean install produced the relocation errors above.

Why now

This wants to land before the FORCE_REBUILD run that republishes the Alpine artifacts for #9.
That rebuild is multi-hour, and without this it would publish 24 packages that have working graphics but still cannot start on a bare Alpine.

Follow-up worth considering

Nothing in CI installs a built package into a clean container, which is why this survived.
A smoke test that does apk add of the produced artifact and runs Rscript -e 'capabilities()' would catch both this class of bug and the one in #9 at the packaging stage.
Happy to add it if you want it.

## Motivation Found while verifying #9 against a published artifact. The Alpine `.apk` installs cleanly and then fails on every invocation, because `libR.so` links against liblzma but the package never declared a dependency on it: ``` Error loading shared library liblzma.so.5: No such file or directory (needed by /opt/R/4.6.1/lib/R/lib/libR.so) Error relocating /opt/R/4.6.1/lib/R/lib/libR.so: lzma_code: symbol not found Error relocating /opt/R/4.6.1/lib/R/lib/libR.so: lzma_stream_decoder: symbol not found ``` The dependency list carried `# - liblzma-dev`, the Debian name. That package does not exist on Alpine, so it had been commented out rather than translated, alongside the other Debian leftovers (`# - libc6`, `# - libgomp1`, `# - libx11-6`). Unlike those, this one is actually required. ## Change Replace it with `xz-dev`, the Alpine equivalent, which pulls `xz-libs`, the package that owns `liblzma.so.5`. Keeping the `-dev` variant matches every other entry in the list, which are deliberately `-dev` so CRAN packages can be built from source on the target. Applied to all five `builder/package.alpine-*` files. ## Verification Repackaged the currently published `r-4.6.1_1_aarch64.apk` with the patched dependency list, then installed it into a clean `alpine:3.22` container with nothing else added: ``` === depends in the repackaged apk === cairo g++ gcc gfortran icu-dev jpeg-dev libbz2 libcurl libdeflate-dev libpaper libpng-dev libtirpc-dev make openblas-dev pango pcre2-dev readline-dev tcl tiff-dev tk unzip xz-dev zip zlib-ng-dev === does R start with no manual extra packages? === OK: R version 4.6.1 (2026-06-24) ``` Before this change the same clean install produced the relocation errors above. ## Why now This wants to land before the `FORCE_REBUILD` run that republishes the Alpine artifacts for #9. That rebuild is multi-hour, and without this it would publish 24 packages that have working graphics but still cannot start on a bare Alpine. ## Follow-up worth considering Nothing in CI installs a built package into a clean container, which is why this survived. A smoke test that does `apk add` of the produced artifact and runs `Rscript -e 'capabilities()'` would catch both this class of bug and the one in #9 at the packaging stage. Happy to add it if you want it.
libR.so links against liblzma, but the Alpine package never declared a
dependency on it. The list carried `# - liblzma-dev`, the Debian name,
which does not exist on Alpine and so had been commented out rather than
translated. The result is a package that installs cleanly and then fails
on every invocation:

  Error loading shared library liblzma.so.5: No such file or directory
    (needed by /opt/R/4.6.1/lib/R/lib/libR.so)
  Error relocating /opt/R/4.6.1/lib/R/lib/libR.so: lzma_code: symbol not found

Replace it with xz-dev, the Alpine equivalent, which pulls xz-libs, the
package that owns liblzma.so.5. Keep the -dev variant to match every other
entry in the list, which are -dev so that CRAN packages can be installed
from source on the target.

Verified by repackaging the currently published r-4.6.1_1_aarch64.apk with
this dependency list and installing it into a clean alpine:3.22 container:
R now starts with no manually added packages, where before it did not.
pat-s merged commit 3028a730f0 into main 2026-09-18 07:14:18 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
devxy/r-builds!10
No description provided.