diff --git a/ci/docker/linux-r.dockerfile b/ci/docker/linux-r.dockerfile index c0d5a69a94e..e089ce30cb6 100644 --- a/ci/docker/linux-r.dockerfile +++ b/ci/docker/linux-r.dockerfile @@ -36,6 +36,9 @@ ENV R_CUSTOM_CCACHE=${r_custom_ccache} ARG r_update_clang=false ENV R_UPDATE_CLANG=${r_update_clang} +ARG r_old_clang=false +ENV R_OLD_CLANG=${r_old_clang} + ARG tz="UTC" ENV TZ=${tz} diff --git a/ci/scripts/r_docker_configure.sh b/ci/scripts/r_docker_configure.sh index b42b444e0b5..851117cb8b4 100755 --- a/ci/scripts/r_docker_configure.sh +++ b/ci/scripts/r_docker_configure.sh @@ -97,5 +97,33 @@ if [ "$R_UPDATE_CLANG" = true ]; then apt install -y clang-20 lld-20 fi +# Use an old clang version to simulate CRAN's macos clang-14 environment. +# This is only for rhub/clang20. If we change the base image from rhub/clang20, +# we need to update this part too. +if [ "$R_OLD_CLANG" = true ]; then + apt update -y --allow-releaseinfo-change # flag needed for when debian version changes + apt install -y clang-14 lld-14 g++-12 libstdc++-12-dev + + update-alternatives --install /usr/bin/clang clang /usr/bin/clang-14 100 + update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-14 100 + update-alternatives --install /usr/bin/lld lld /usr/bin/lld-14 100 + + clang --version + clang++ --version + + mkdir -p ~/.R + cat <<'EOF' > ~/.R/Makevars +CC=clang-14 +CXX=clang++-14 + +CXX11=clang++-14 +CXX14=clang++-14 +CXX17=clang++-14 +CXX20=clang++-14 + +LDFLAGS=-fuse-ld=lld +EOF +fi + # Workaround for html help install failure; see https://github.com/r-lib/devtools/issues/2084#issuecomment-530912786 Rscript -e 'x <- file.path(R.home("doc"), "html"); if (!file.exists(x)) {dir.create(x, recursive=TRUE); file.copy(system.file("html/R.css", package="stats"), x)}' diff --git a/compose.yaml b/compose.yaml index 87b79300011..ed1a5a06077 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1667,6 +1667,7 @@ services: r_prune_deps: ${R_PRUNE_DEPS} r_custom_ccache: ${R_CUSTOM_CCACHE} r_update_clang: ${R_UPDATE_CLANG} + r_old_clang: ${R_OLD_CLANG} shm_size: *shm-size environment: <<: [*common, *sccache] diff --git a/dev/tasks/r/github.linux.cran.yml b/dev/tasks/r/github.linux.cran.yml index 8e073db775f..af258118d12 100644 --- a/dev/tasks/r/github.linux.cran.yml +++ b/dev/tasks/r/github.linux.cran.yml @@ -34,12 +34,14 @@ jobs: - { r_image: "ubuntu-next" } # ~ r-patched-linux-x86_64 - { r_image: "ubuntu-release" } # ~ r-release-linux-x86_64 - { r_image: "clang20", skip_vignettes: true, r_update_clang: true } # ~ r-devel-linux-x86_64-fedora-clang + - { r_image: "clang16", skip_vignettes: true, r_old_clang: true } # ~ r-devel-linux-x86_64-fedora-clang env: R_ORG: "rhub" R_IMAGE: {{ '${{ matrix.config.r_image }}' }} R_TAG: "latest" ARROW_R_DEV: "FALSE" R_UPDATE_CLANG: {{ '${{ matrix.config.r_update_clang }}' }} + R_OLD_CLANG: {{ '${{ matrix.config.r_old_clang }}' }} steps: {{ macros.github_checkout_arrow()|indent }} {{ macros.github_install_archery()|indent }}