From 4d089e8d0133db08d18f6d2589f9ec24dd117391 Mon Sep 17 00:00:00 2001 From: pat-s Date: Sat, 6 Dec 2025 15:47:59 +0100 Subject: [PATCH] chore: fix alpine3.22+ builds with R <= 4.4.0 --- builder/build.sh | 13 +++++++++++++ builder/docker-compose.yml | 1 + 2 files changed, 14 insertions(+) diff --git a/builder/build.sh b/builder/build.sh index 549e461..427da6e 100755 --- a/builder/build.sh +++ b/builder/build.sh @@ -110,6 +110,19 @@ compile_r() { echo "Setting FFLAGS: ${FFLAGS}" fi + # R 4.3.x and below have K&R style XDR code that fails with GCC 14+ + # GCC 14 treats () in prototypes as "zero args" instead of "unspecified args" + # Using -std=gnu17 restores the old behavior where () means unspecified args + # Fixed in R 4.4.0: https://bugs.r-project.org/show_bug.cgi?id=18755 + echo "DEBUG: r_version=${r_version}, gcc_major_version=${gcc_major_version}" + echo "DEBUG: Checking if ${r_version} < 4.4.0 AND ${gcc_major_version} > 13" + if _version_is_less_than "${r_version}" 4.4.0 && _version_is_greater_than "${gcc_major_version}" 13; then + export CFLAGS="${CFLAGS:--g -O2} -std=gnu17" + echo "Setting CFLAGS for GCC 14+ compatibility: ${CFLAGS}" + else + echo "DEBUG: Condition not met, skipping GCC 14 workaround" + fi + # Avoid a PCRE2 dependency for R 3.5 and 3.6. R 3.x uses PCRE1, but R 3.5+ # will link against PCRE2 if present, although it is not actually used. # Since there's no way to disable this in the configure script, and we need diff --git a/builder/docker-compose.yml b/builder/docker-compose.yml index 8e06b87..63094ea 100644 --- a/builder/docker-compose.yml +++ b/builder/docker-compose.yml @@ -83,6 +83,7 @@ services: image: r-builds:alpine-323 volumes: - /tmp/alpine-323:/tmp/output/alpine-323 + - ./build.sh:/build.sh:ro debian-10: command: ./build.sh environment: