Skip to content

Apache DataFusion SQL Query Engine

ARROW-9397: [R] Pass CC/CXX et al. to cmake when building libarrow in Linux build

Neal Richardson7a7d9126f4f2
diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml
index a5f7503ff0..5b216290bd 100644
--- a/.github/workflows/r.yml
+++ b/.github/workflows/r.yml
@@ -84,8 +84,7 @@ jobs:
sudo sysctl -w kernel.core_pattern="core.%e.%p"
ulimit -c unlimited
archery docker run ubuntu-r
- - name: Dump install logs on failure
- if: failure()
+ - name: Dump install logs
run: cat r/check/arrow.Rcheck/00install.out
- name: Docker Push
if: success() && github.event_name == 'push' && github.repository == 'apache/arrow'
@@ -133,8 +132,7 @@ jobs:
sudo sysctl -w kernel.core_pattern="core.%e.%p"
ulimit -c unlimited
archery docker run r
- - name: Dump install logs on failure
- if: failure()
+ - name: Dump install logs
run: cat r/check/arrow.Rcheck/00install.out
- name: Docker Push
if: success() && github.event_name == 'push' && github.repository == 'apache/arrow'
diff --git a/ci/docker/linux-r.dockerfile b/ci/docker/linux-r.dockerfile
index 5de562d55c..2ec42fb6c1 100644
--- a/ci/docker/linux-r.dockerfile
+++ b/ci/docker/linux-r.dockerfile
@@ -27,10 +27,10 @@ ENV PATH "${RPREFIX}/bin:${PATH}"
# and use pre-built binaries where possible
COPY ci/etc/rprofile /arrow/ci/etc/
RUN cat /arrow/ci/etc/rprofile >> $(R RHOME)/etc/Rprofile.site
-# Also ensure parallel compilation of C/C++ code
-RUN echo "MAKEFLAGS=-j$(R -s -e 'cat(parallel::detectCores())')" >> $(R RHOME)/etc/Makeconf
-# Workaround for html help install failure; see https://github.com/r-lib/devtools/issues/2084#issuecomment-530912786
-RUN 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)}'
+
+# Patch up some of the docker images
+COPY ci/scripts/r_docker_configure.sh /arrow/ci/scripts/
+RUN /arrow/ci/scripts/r_docker_configure.sh
COPY ci/scripts/r_deps.sh /arrow/ci/scripts/
COPY r/DESCRIPTION /arrow/r/
diff --git a/ci/scripts/r_deps.sh b/ci/scripts/r_deps.sh
index 172e054d20..a2dc58fd97 100755
--- a/ci/scripts/r_deps.sh
+++ b/ci/scripts/r_deps.sh
@@ -29,9 +29,3 @@ ${R_BIN} -e "install.packages('remotes'); remotes::install_cran(c('glue', 'rcmdc
${R_BIN} -e "remotes::install_deps(dependencies = TRUE)"
popd
-
-if [ "`which curl`" ]; then
- # We need this on R >= 4.0
- curl -L https://sourceforge.net/projects/checkbaskisms/files/2.0.0.2/checkbashisms/download > /usr/local/bin/checkbashisms
- chmod 755 /usr/local/bin/checkbashisms
-fi
diff --git a/ci/scripts/r_docker_configure.sh b/ci/scripts/r_docker_configure.sh
new file mode 100755
index 0000000000..9b131f21cb
--- /dev/null
+++ b/ci/scripts/r_docker_configure.sh
@@ -0,0 +1,42 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -ex
+
+: ${R_BIN:=R}
+
+# Ensure parallel compilation of C/C++ code
+echo "MAKEFLAGS=-j$(R -s -e 'cat(parallel::detectCores())')" >> $(R RHOME)/etc/Makeconf
+
+# Special hacking to try to reproduce quirks on fedora-clang-devel on CRAN
+# which uses a bespoke clang compiled to use libc++
+# https://www.stats.ox.ac.uk/pub/bdr/Rconfig/r-devel-linux-x86_64-fedora-clang
+if [ "$RHUB_PLATFORM" = "linux-x86_64-fedora-clang" ]; then
+ dnf install -y libcxx-devel
+ sed -i.bak -E -e 's/(CXX1?1? =.*)/\1 -stdlib=libc++/g' $(R RHOME)/etc/Makeconf
+ rm -rf $(R RHOME)/etc/Makeconf.bak
+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)}'
+
+if [ "`which curl`" ]; then
+ # We need this on R >= 4.0
+ curl -L https://sourceforge.net/projects/checkbaskisms/files/2.0.0.2/checkbashisms/download > /usr/local/bin/checkbashisms
+ chmod 755 /usr/local/bin/checkbashisms
+fi