chore: fix alpine3.22+ builds with R <= 4.4.0
Some checks failed
ci/crow/cron/build/4 Pipeline failed
ci/crow/cron/build/13 Pipeline was successful
ci/crow/cron/build/7 Pipeline was successful
ci/crow/cron/build/11 Pipeline was successful
ci/crow/cron/build/9 Pipeline was successful
ci/crow/cron/build/10 Pipeline was successful
ci/crow/cron/build/12 Pipeline was successful
ci/crow/cron/build/14 Pipeline was successful
ci/crow/cron/build/5 Pipeline failed
ci/crow/cron/build/8 Pipeline failed
ci/crow/cron/build/6 Pipeline failed
ci/crow/cron/build/2 Pipeline failed
ci/crow/cron/build/1 Pipeline failed
ci/crow/cron/build/3 Pipeline failed

This commit is contained in:
Patrick Schratz 2025-12-06 15:47:59 +01:00
commit 4d089e8d01
Signed by: pat-s
GPG key ID: 3C6318841EF78925

View file

@ -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