Skip to content

Commit 130f292

Browse files
committed
Fix musllinux build failures for old R versions
- Add texmf-dist-fontsrecommended to Dockerfile for rsfs TFM fonts needed by R vignettes (e.g., R 4.2.2) - Pre-seed r_cv_libc_stack_end=no on musl to fix undefined reference to __libc_stack_end for R <= 4.x - Add -Wno-incompatible-pointer-types for R < 3.2.0 with GCC >= 14 to fix Matrix COLAMD build failure
1 parent 386199e commit 130f292

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

builder/Dockerfile.musllinux_1_2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ RUN apk update && apk add --no-cache \
4444
tcl-dev \
4545
texinfo \
4646
texlive \
47+
texmf-dist-fontsrecommended `# Provides rsfs TFM fonts needed by R vignettes` \
4748
texmf-dist-latexrecommended \
4849
tk-dev \
4950
valgrind-dev \

builder/build.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ compile_r() {
108108
export FFLAGS="$FFLAGS -fallow-argument-mismatch"
109109
fi
110110

111+
# GCC 14 and above makes -Wincompatible-pointer-types a hard error
112+
# (e.g., on Alpine 3.21, Fedora 42). Old recommended packages bundled
113+
# with R (e.g. Matrix's COLAMD) have incompatible pointer type
114+
# assignments that trigger this.
115+
if _version_is_less_than "${r_version}" 3.2.0 && _version_is_greater_than "${gcc_major_version}" 13; then
116+
export CFLAGS="$CFLAGS -Wno-incompatible-pointer-types"
117+
fi
118+
111119
# GCC 15 and above needs -std=gnu11, because it defaults to C23, and R
112120
# versions below R 4.5.0 do not compile in C23 mode.
113121
if _version_is_less_than "${r_version}" 4.5.0 && _version_is_greater_than "${gcc_major_version}" 14; then
@@ -166,6 +174,16 @@ compile_r() {
166174

167175
echo "Using CONFIGURE_OPTIONS: ${CONFIGURE_OPTIONS}"
168176

177+
# musl libc (e.g., Alpine) does not have __libc_stack_end (a glibc-specific
178+
# symbol). R's configure test in R <= 4.x links against it without checking
179+
# the value, so the test passes on musl but the final build fails with
180+
# "undefined reference to `__libc_stack_end'". Pre-seed the cache variable
181+
# to skip this check. R 4.2.1+ improved the test to also dereference the
182+
# symbol, but we apply this unconditionally for safety.
183+
if ldd --version 2>&1 | grep -qi musl; then
184+
export r_cv_libc_stack_end=no
185+
fi
186+
169187
# set some common environment variables for the configure step
170188
AWK=/usr/bin/awk \
171189
LIBnn=lib \

0 commit comments

Comments
 (0)