Skip to content

Commit a3bcc0b

Browse files
committed
docker: pre-install testthat with patched Catch.h for glibc 2.34+ compat
1 parent eac2245 commit a3bcc0b

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

common/dockerfiles/Dockerfile.base

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,6 @@ rm -rf /tmp/R-3.4.4*
111111
# shared object file" at rpy2 import time.
112112
echo "/usr/local/lib/R/lib" > /etc/ld.so.conf.d/R.conf
113113
ldconfig
114-
# glibc 2.34+ redefined SIGSTKSZ from a compile-time constant to a sysconf
115-
# call, breaking vendored Catch.h's static-array sizing in testthat. Pin
116-
# the old constant value so R package compiles see an integral expression.
117-
echo "CPPFLAGS += -DSIGSTKSZ=8192" >> /usr/local/lib/R/etc/Makevars.site
118114
EOF
119115

120116
# Bioconductor 3.6's biocLite.R bootstrap URL is permanently 404 (Bioc
@@ -124,6 +120,23 @@ EOF
124120
# library, renv::restore detects it and skips the dead bootstrap fetch.
125121
RUN R -e 'install.packages("https://bioconductor.org/packages/3.6/bioc/src/contrib/BiocInstaller_1.28.0.tar.gz", repos = NULL, type = "source")'
126122

123+
# testthat 2.3.2's vendored Catch.h declares `static char altStackMem[SIGSTKSZ]`,
124+
# which glibc 2.34+ broke by redefining SIGSTKSZ from a compile-time constant
125+
# to a sysconf() call. Pre-install testthat with both altStackMem decls patched
126+
# to a fixed 8192 (the old glibc constant, well above POSIX's MINSIGSTKSZ).
127+
# renv::restore then sees the lockfile-pinned version already installed and
128+
# skips the broken recompile.
129+
RUN <<EOF
130+
cd /tmp
131+
wget -q https://cran.r-project.org/src/contrib/Archive/testthat/testthat_2.3.2.tar.gz
132+
tar xzf testthat_2.3.2.tar.gz
133+
sed -i 's/altStackMem\[SIGSTKSZ\]/altStackMem[8192]/g' \
134+
testthat/inst/include/testthat/vendor/catch.h
135+
R CMD INSTALL testthat
136+
cd /
137+
rm -rf /tmp/testthat*
138+
EOF
139+
127140
ENV R_LIBS=/usr/local/lib/R/site-library
128141

129142
COPY config/ config/

0 commit comments

Comments
 (0)