Skip to content

Commit 2d447c4

Browse files
authored
GH-36193: [R] arm64 binaries for R (#48574)
### Rationale for this change Issues building on ARM ### What changes are included in this PR? CI job and nixlibs update ### Are these changes tested? On CI ### Are there any user-facing changes? No AI changes 🤖: Claude decided where to make the changes and helped debug failing builds, but I updated most of it (e.g. rstudio -> posit, choice of runners etc) * GitHub Issue: #36193 Authored-by: Nic Crane <thisisnic@gmail.com> Signed-off-by: Nic Crane <thisisnic@gmail.com>
1 parent 961258d commit 2d447c4

6 files changed

Lines changed: 47 additions & 23 deletions

File tree

compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1749,7 +1749,7 @@ services:
17491749
cache_from:
17501750
- ${REPO}:r-rstudio-r-base-4.2-focal-revdepcheck
17511751
args:
1752-
base: rstudio/r-base:4.2-focal
1752+
base: posit/r-base:4.2-focal
17531753
r_dev: ${ARROW_R_DEV}
17541754
tz: ${TZ}
17551755
shm_size: *shm-size

dev/tasks/macros.jinja

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,13 @@ env:
223223
path: repo/libarrow
224224
{% endif %}
225225
{% if get_nix %}
226-
- name: Get Linux binary
226+
{% for arch in ["x86_64", "arm64"] %}
227+
- name: Get Linux {{ arch }} binary
227228
uses: actions/download-artifact@v4
228229
with:
229-
name: r-libarrow-linux-x86_64
230+
name: r-libarrow-linux-{{ arch }}
230231
path: repo/libarrow
232+
{% endfor %}
231233
{% endif %}
232234
{% if get_mac %}
233235
{% for arch in ["x86_64", "arm64"] %}

dev/tasks/r/github.linux.versions.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121

2222
jobs:
2323
r-versions:
24-
name: "rstudio/r-base:{{ MATRIX }}-jammy"
24+
name: "posit/r-base:{{ MATRIX }}-jammy"
2525
runs-on: ubuntu-latest
2626
strategy:
2727
fail-fast: false
2828
matrix:
29-
# See https://hub.docker.com/r/rstudio/r-base
29+
# See https://hub.docker.com/r/posit/r-base
3030
r_version:
3131
# We test devel, release, and oldrel in regular CI.
3232
# This is for older versions

dev/tasks/r/github.packages.yml

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,22 +110,31 @@ jobs:
110110
{{ '${{ env.PKG_FILE }}' }}.sha512
111111
112112
linux-cpp:
113-
name: C++ Binary Linux
114-
runs-on: ubuntu-latest
113+
name: C++ Binary Linux {{ '${{ matrix.arch }}' }}
114+
runs-on: {{ '${{ matrix.runs-on }}' }}
115115
needs: source
116116
strategy:
117117
fail-fast: false
118+
matrix:
119+
include:
120+
- arch: x86_64
121+
runs-on: ubuntu-latest
122+
ubuntu: "22.04"
123+
- arch: arm64
124+
runs-on: ubuntu-24.04-arm
125+
ubuntu: "22.04"
118126
env:
119-
PKG_ID: r-libarrow-linux-x86_64
120-
PKG_FILE: r-libarrow-linux-x86_64-{{ '${{ needs.source.outputs.pkg_version }}' }}.zip
127+
PKG_ID: r-libarrow-linux-{{ '${{ matrix.arch }}' }}
128+
PKG_FILE: r-libarrow-linux-{{ '${{ matrix.arch }}' }}-{{ '${{ needs.source.outputs.pkg_version }}' }}.zip
121129
steps:
122130
{{ macros.github_checkout_arrow()|indent }}
123131
{{ macros.github_change_r_pkg_version(is_fork, '${{ needs.source.outputs.pkg_version }}')|indent }}
124132
{{ macros.github_install_archery()|indent }}
125133
- name: Build libarrow
126134
shell: bash
127135
env:
128-
UBUNTU: "22.04"
136+
ARCH: {{ "${{ matrix.arch == 'x86_64' && 'amd64' || 'arm64v8' }}" }}
137+
UBUNTU: {{ '${{ matrix.ubuntu }}' }}
129138
{{ macros.github_set_sccache_envvars()|indent(8) }}
130139
run: |
131140
source arrow/ci/scripts/util_enable_core_dumps.sh
@@ -291,8 +300,8 @@ jobs:
291300
path: arrow_*
292301
test-linux-binary:
293302
needs: [source, linux-cpp]
294-
name: Test binary {{ '${{ matrix.config.image }}' }}
295-
runs-on: ubuntu-latest
303+
name: Test binary {{ '${{ matrix.config.image }}' }} {{ '${{ matrix.config.runner }}' }}
304+
runs-on: {{ '${{ matrix.config.runner }}' }}
296305
container: {{ '${{ matrix.config.image }}' }}
297306
strategy:
298307
fail-fast: false
@@ -303,13 +312,18 @@ jobs:
303312
# an OS that is not in the allowlist, so we have to opt-in to use the
304313
# binary. Other env vars used in r_docker_configure.sh can be added
305314
# here and wired up in the later steps.
306-
- {image: "rhub/ubuntu-clang", libarrow_binary: "TRUE"}
315+
# x86_64 tests
316+
- {image: "rhub/ubuntu-clang", libarrow_binary: "TRUE", runner: "ubuntu-latest"}
307317
# fedora-clang-devel cannot use binaries bc of libc++ (uncomment to see the error)
308-
# - {image: "rhub/fedora-clang-devel", libarrow_binary: "TRUE"}
309-
- {image: "rhub/ubuntu-release"} # currently ubuntu-22.04
310-
- {image: "rstudio/r-base:4.1-jammy"}
311-
- {image: "rstudio/r-base:4.2-jammy"}
312-
- {image: "rstudio/r-base:4.3-noble"}
318+
# - {image: "rhub/fedora-clang-devel", libarrow_binary: "TRUE", runner: "ubuntu-latest"}
319+
- {image: "rhub/ubuntu-release", runner: "ubuntu-latest"} # currently ubuntu-24.04
320+
- {image: "posit/r-base:4.3-noble", runner: "ubuntu-latest"}
321+
- {image: "posit/r-base:4.4-noble", runner: "ubuntu-latest"}
322+
- {image: "posit/r-base:4.5-noble", runner: "ubuntu-latest"}
323+
# ARM64 tests
324+
- {image: "posit/r-base:4.3-noble", runner: "ubuntu-24.04-arm"}
325+
- {image: "posit/r-base:4.4-noble", runner: "ubuntu-24.04-arm"}
326+
- {image: "posit/r-base:4.5-noble", runner: "ubuntu-24.04-arm"}
313327
steps:
314328
# Get the arrow checkout just for the docker config scripts
315329
# Don't need submodules for this (hence false arg to macro): they fail on
@@ -350,7 +364,7 @@ jobs:
350364
if: false
351365
needs: test-linux-binary
352366
runs-on: ubuntu-latest
353-
container: "rstudio/r-base:4.2-centos7"
367+
container: "posit/r-base:4.2-centos7"
354368
steps:
355369
- uses: actions/download-artifact@v4
356370
with:

r/tools/nixlibs.R

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,21 @@ check_allowlist <- function(
255255
any(grepl(paste(allowlist, collapse = "|"), os))
256256
}
257257

258+
normalise_arch <- function(arch) {
259+
if (arch %in% c("aarch64", "arm64")) {
260+
return("arm64")
261+
}
262+
arch
263+
}
264+
258265
select_binary <- function(
259266
os = tolower(Sys.info()[["sysname"]]),
260267
arch = tolower(Sys.info()[["machine"]]),
261268
test_program = test_for_curl_and_openssl
262269
) {
263-
if (identical(os, "darwin") || (identical(os, "linux") && identical(arch, "x86_64"))) {
264-
# We only host x86 linux binaries and x86 & arm64 macos today
270+
arch <- normalise_arch(arch)
271+
272+
if (identical(os, "darwin") || identical(os, "linux")) {
265273
binary <- tryCatch(
266274
# Somehow the test program system2 call errors on the sanitizer builds
267275
# so globally handle the possibility that this could fail

r/tools/test-nixlibs.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ test_that("identify_binary() based on LIBARROW_BINARY", {
5252

5353
test_that("select_binary() based on system", {
5454
expect_output(
55-
expect_null(select_binary("linux", arch = "aarch64")), # Not built today
56-
"Building on linux aarch64"
55+
expect_null(select_binary("freebsd", arch = "x86_64")),
56+
"Building on freebsd x86_64"
5757
)
5858
})
5959

0 commit comments

Comments
 (0)