[R-pkg-devel] new package version fails on r-devel fedora clang

Dirk Eddelbuettel edd @end|ng |rom deb|@n@org
Fri Oct 3 17:08:23 CEST 2025


Tony,

The script below should set you up for clang-22 on the rocker/r-base
container running Debian testing/unstable, and ensure R uses clang-22.

The fact that clang-22 passes the build whereas as the clang-21 version at
CRAN encounters an error may be indicative on an issue in that clang-21, but
it is hard to tell for sure.

For another test I ensured I also used -O3 and -D_FORTIFY_SOURCE=3 (switching
from the Debian defaults of 2). There are a number of other flags that
differ, and they may matter.  It still appears to build (if slowly, seems
like there is a fair bit of complex C++ in there). [ Minutes later ] It seems
to hang at compilation of rcpp_bc_b.cpp.  So the higher optimization level on
the Fedora machine at CRAN may have something to do with this -- using -O2
and -D_FORTIFY_SOURCE=2 worked here.  You could ask for re-check given that
clang 21 and 22 apparently build your package in the Debian container I used,
at least with the lower default values used by the Debian setup.

Dirk

-----------------------------------------------------------------------------
#!/bin/sh

## Update does not hurt but is not strictly needed
#apt update --quiet --quiet
#apt upgrade --yes

## wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
## or as we are root in container
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key > /etc/apt/trusted.gpg.d/apt.llvm.org.asc

cat <<EOF >/etc/apt/sources.list.d/llvm-dev.sources
Types: deb
URIs: http://apt.llvm.org/unstable/
# for clang-21 
#   Suites: llvm-toolchain-21
# for current clang
Suites: llvm-toolchain
Components: main
Signed-By: /etc/apt/trusted.gpg.d/apt.llvm.org.asc
EOF

test -d ~/.R || mkdir ~/.R
cat <<EOF >~/.R/Makevars
CLANGVER=-22
# CLANGLIB=-stdlib=libc++
CXX=clang++\$(CLANGVER) \$(CLANGLIB)
CXX11=clang++\$(CLANGVER) \$(CLANGLIB)
CXX14=clang++\$(CLANGVER) \$(CLANGLIB)
CXX17=clang++\$(CLANGVER) \$(CLANGLIB)
CXX20=clang++\$(CLANGVER) \$(CLANGLIB)
CC=clang\$(CLANGVER)
SHLIB_CXXLD=clang++\$(CLANGVER) \$(CLANGLIB)
EOF

apt update
apt install --yes clang-22

-----------------------------------------------------------------------------

-- 
dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org



More information about the R-package-devel mailing list