No description
  • Shell 75.1%
  • Python 11.4%
  • R 6%
  • Makefile 3%
  • Just 1.7%
  • Other 2.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
pat-s 1362e0bd3a fix(alpine): build R with cairo, png, jpeg and tiff graphics devices (#9)
## Motivation

R on the Alpine images was built without graphics support: `capabilities()` reports `cairo`, `png`, `jpeg` and `tiff` as `FALSE`, while Ubuntu reports all four `TRUE`.
The images install `R-dev` but never the graphics headers, and R's `configure` treats those as optional and does not fail when they are absent, so the build succeeds and ships an R that cannot draw.

Reproduced in a clean `alpine:3.22` container with the old package set:

```
Additional capabilities:  PNG, NLS, ICU
Capabilities skipped:     JPEG, TIFF, cairo
```

One correction to the original diagnosis: `--with-x=no` was not the cause, and libpng was in fact found.
R's bitmap and `pangocairo` checks run independently of `R_X11` (`configure.ac:2604` gates on `want_cairo`, not `use_X11`).
`capabilities("png")` needs a device *backend*, and with X11 off and cairo absent there was none, which is why all four read `FALSE` despite configure listing PNG.
So the fix is purely the missing `-dev` packages.
X11 stays off, which is correct for headless images, and cairo covers `png()` / `jpeg()` / `tiff()` / `svg()`.

## Changes

- `builder/Dockerfile.alpine-{320,321,322,323,324}` — install `pkgconf cairo-dev pango-dev fontconfig-dev freetype-dev libpng-dev jpeg-dev tiff-dev zlib-dev`; pass `--with-cairo --with-libpng --with-jpeglib --with-libtiff` explicitly so the intent sits next to `--with-x=no`; set `REQUIRED_CAPABILITIES`.
- `builder/build.sh` — add `verify_capabilities()` between `compile_r` and `package_r`. A build that loses a graphics device now fails instead of being packaged and uploaded. Opt-in via `REQUIRED_CAPABILITIES`, so every non-Alpine platform is untouched.
- `.crow/build.yaml` — add a `FORCE_REBUILD` escape hatch to the dedup step. Artifact filenames carry only the R version, so the HEAD probe would otherwise keep skipping every Alpine version and serving the stale broken binaries.
- `CLAUDE.md` — record the three gotchas.

## Verification

Compiled R 4.5.1 in the patched `alpine-322` image, through the real `build.sh`:

```
       jpeg         png        tiff       tcltk         X11        aqua
       TRUE        TRUE        TRUE        TRUE       FALSE       FALSE
        NLS       Rprof     profmem       cairo         ICU long.double
       TRUE        TRUE        TRUE        TRUE        TRUE        TRUE
All required capabilities are present.
```

The devices actually render, not just report `TRUE` (`default bitmapType: cairo`):

```
png   -> t.png (2154 bytes)
jpeg  -> t.jpeg (4489 bytes)
tiff  -> t.tiff (120160 bytes)
svg   -> t.svg (9381 bytes)
```

The guard was exercised in both directions against that real build: it passes on the four graphics capabilities, and returns non-zero naming the missing entry when additionally asked for `X11`.
`crow lint .crow/` passes and `bash -n builder/build.sh` is clean.

## Behaviour change

Alpine R binaries gain the cairo, png, jpeg and tiff devices, and link against `libcairo`, `libpangocairo`, `libpng`, `libjpeg` and `libtiff`.
The `.apk` metadata already declared those runtime dependencies, so consumer images need no change.
Any Alpine build that loses a graphics device now fails the pipeline rather than uploading silently.

**Needs a follow-up after merge:** the first run must have `FORCE_REBUILD` set, otherwise dedup skips every existing Alpine version and the broken artifacts stay in the bucket.

Reviewed-on: #9
2026-09-18 07:04:22 +00:00
.crow fix(alpine): build R with cairo, png, jpeg and tiff graphics devices (#9) 2026-09-18 07:04:22 +00:00
.github Add @stevenolen to CODEOWNERS for Ubuntu image/packaging changes 2024-05-08 18:37:09 -05:00
builder fix(alpine): build R with cairo, png, jpeg and tiff graphics devices (#9) 2026-09-18 07:04:22 +00:00
jenkins refactor: awscli -> s5cmd, add alpine 323 2025-12-06 12:33:35 +01:00
test feat: add Ubuntu 26.04 (Resolute) support 2026-04-24 13:20:25 +02:00
.gitignore make repo public 2019-03-25 12:59:14 -04:00
build.sh add alpine 2024-08-28 00:31:41 +02:00
CLAUDE.md fix(alpine): build R with cairo, png, jpeg and tiff graphics devices (#9) 2026-09-18 07:04:22 +00:00
deploy.Jenkinsfile Fix deploy job; use absolute path for HOME 2023-07-06 18:16:43 -05:00
handler.py Update versions.json generation for addition of .tar.xz source files 2024-02-29 13:28:58 -06:00
install.sh Adds Oracle Linux support 2024-02-12 23:44:33 +00:00
Jenkinsfile Update default branch to main 2022-11-30 15:50:40 -06:00
Justfile feat: add alpine-3.24 build config (#5) 2026-06-12 13:46:11 +00:00
LICENSE make repo public 2019-03-25 12:59:14 -04:00
Makefile feat: add alpine-3.24 build config (#5) 2026-06-12 13:46:11 +00:00
package-lock.json Update serverless version, remove serverless-pseudo-parameters as it's functionality is part of serverless since 2.5 2024-05-20 14:48:01 -04:00
package.json Update serverless version, remove serverless-pseudo-parameters as it's functionality is part of serverless since 2.5 2024-05-20 14:48:01 -04:00
README.md CI 2024-06-10 10:02:34 +02:00
renovate.json chore: add renovate config 2025-06-13 21:26:21 +02:00
requirements.txt Upgrade python to 3.11, upgrade packages to support python 3.11 2024-05-20 11:34:51 -04:00
serverless-resources.yml Fix invalid image for fedora-40 2024-05-24 16:58:54 -05:00
serverless-stepf.yml You cannot use the short version of the functions in the serverless-step-functions plugin, it's not supported at this time 2024-05-20 16:38:53 -04:00
serverless.yml Merge pull request #217 from rstudio/fedora40 2024-05-24 10:06:13 +02:00

r-builds

Builds R interpreter binaries for Linux.

  • No changes to upstream code (rstudio/r-builds) is made
  • Binaries are only built if they do not yet exist in the S3 bucket