Repository navigation
GH-50612: [R] Build R package on WinARM #55841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
0c35e69
643fb93
b3c9b42
7b9f7a5
f8b52da
2bdd35a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -171,20 +171,22 @@ jobs: | |
| {{ '${{ env.PKG_FILE }}' }}.sha512 | ||
| windows-cpp: | ||
| name: C++ Binary Windows RTools {{ '${{ matrix.config.rtools }}' }} | ||
| name: C++ Binary Windows {{ '${{ matrix.config.arch }}' }} RTools {{ '${{ matrix.config.rtools }}' }} | ||
| needs: source | ||
| runs-on: windows-latest | ||
| runs-on: {{ '${{ matrix.config.runs_on }}' }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| config: | ||
| # R is not used, but setup-r picks Rtools from r-version: R 4.1 was | ||
| # the last R to use Rtools40. The Rtools40 binary is for R < 4.4. | ||
| - { rtools: 40, r: "4.1", script: r_windows_build_rtools40.sh } | ||
| - { rtools: 45, r: "4.5", script: r_windows_build.sh } | ||
| # On windows-11-arm setup-r installs the aarch64 Rtools45. | ||
| - { rtools: 40, arch: x86_64, r: "4.1", script: r_windows_build_rtools40.sh, runs_on: windows-latest } | ||
| - { rtools: 45, arch: x86_64, r: "4.6", script: r_windows_build.sh, runs_on: windows-latest } | ||
| - { rtools: 45, arch: aarch64, r: "4.6", script: r_windows_build.sh, runs_on: windows-11-arm } | ||
| env: | ||
| PKG_ID: r-libarrow-windows-x86_64-rtools{{ '${{ matrix.config.rtools }}' }} | ||
| PKG_FILE: r-libarrow-windows-x86_64-rtools{{ '${{ matrix.config.rtools }}' }}-{{ '${{ needs.source.outputs.pkg_version }}' }}.zip | ||
| PKG_ID: r-libarrow-windows-{{ '${{ matrix.config.arch }}' }}-rtools{{ '${{ matrix.config.rtools }}' }} | ||
| PKG_FILE: r-libarrow-windows-{{ '${{ matrix.config.arch }}' }}-rtools{{ '${{ matrix.config.rtools }}' }}-{{ '${{ needs.source.outputs.pkg_version }}' }}.zip | ||
| steps: | ||
| - run: git config --global core.autocrlf false | ||
| {{ macros.github_checkout_arrow()|indent }} | ||
|
|
@@ -202,6 +204,7 @@ jobs: | |
| env: | ||
| ARROW_HOME: "arrow" | ||
| MINGW_ARCH: "ucrt64" | ||
| RTOOLS_ARCH: {{ '${{ matrix.config.arch }}' }} | ||
| {{ macros.github_set_sccache_envvars()|indent(8) }} | ||
| run: arrow/ci/scripts/{{ '${{ matrix.config.script }}' }} | ||
| - name: Create Checksum | ||
|
|
@@ -231,9 +234,11 @@ jobs: | |
| - { runs_on: macos-26, name: "macOS arm64" } | ||
| r_version: [oldrel, release] | ||
| include: | ||
| # Tests the Rtools40 libarrow binary, which R < 4.4 downloads. The | ||
| # R package built here is not uploaded. | ||
| # These rows test libarrow binaries the rows above don't use: Rtools40 | ||
| # (which R < 4.4 downloads) and aarch64. Their R packages are not | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not? |
||
| # uploaded. | ||
| - { platform: { runs_on: 'windows-latest', name: "Windows"}, r_version: "4.3" } | ||
| - { platform: { runs_on: 'windows-11-arm', name: "Windows aarch64"}, r_version: "release" } | ||
| steps: | ||
| - uses: r-lib/actions/setup-r@v2 | ||
| with: | ||
|
|
@@ -314,7 +319,7 @@ jobs: | |
| cat(cmd, file = Sys.getenv("GITHUB_OUTPUT"), append = TRUE) | ||
| - name: Upload binary artifact | ||
| if: matrix.r_version != '4.3' | ||
| if: matrix.r_version != '4.3' && matrix.platform.name != 'Windows aarch64' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: r-pkg{{ '${{ steps.build.outputs.path }}' }} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,7 +87,12 @@ function configure_binaries() { | |
| # (GH-55165). | ||
| UTF8PROC_SNAPPY_LIBS="-lutf8proc -lsnappy" | ||
| RE2_LIBS="-lre2" | ||
| CURL_LIBS_FILE="${RWINLIB#../}/lib/x64-ucrt/libcurl.libs" | ||
| # $(R_ARCH) is empty in aarch64 R, so ask R for its architecture. | ||
| case "$("${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e 'cat(R.version$arch)')" in | ||
| aarch64) RWINLIB_ARCH_DIR="aarch64-ucrt" ;; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Neither here nor there but |
||
| *) RWINLIB_ARCH_DIR="x64-ucrt" ;; | ||
| esac | ||
| CURL_LIBS_FILE="${RWINLIB#../}/lib/${RWINLIB_ARCH_DIR}/libcurl.libs" | ||
| if [ -f "${CURL_LIBS_FILE}" ]; then | ||
| UTF8PROC_SNAPPY_LIBS="" | ||
| RE2_LIBS="" | ||
|
|
@@ -100,11 +105,11 @@ function configure_binaries() { | |
| -DARROW_R_WITH_DATASET -DARROW_R_WITH_JSON \ | ||
| -DARROW_R_WITH_S3 -DARROW_R_WITH_GCS" # -DARROW_R_WITH_AZURE | ||
| PKG_LIBS="-L${RWINLIB}/lib"'$(subst gcc,,$(COMPILED_BY))$(R_ARCH) ' | ||
| PKG_LIBS="$PKG_LIBS -L${RWINLIB}/lib"'$(R_ARCH)$(CRT) ' | ||
| PKG_LIBS="$PKG_LIBS -L${RWINLIB}/lib/${RWINLIB_ARCH_DIR} " | ||
| PKG_LIBS="$PKG_LIBS -larrow_dataset -larrow_acero -lparquet -larrow_compute -larrow_s3 \ | ||
| -larrow_gcs \$(if \$(wildcard \ | ||
| ${RWINLIB}/lib\$(subst gcc,,\$(COMPILED_BY))\$(R_ARCH)/libarrow_gcs_bundled_dependencies.a \ | ||
| ${RWINLIB}/lib\$(R_ARCH)\$(CRT)/libarrow_gcs_bundled_dependencies.a),-larrow_gcs_bundled_dependencies) -larrow \ | ||
| ${RWINLIB}/lib/${RWINLIB_ARCH_DIR}/libarrow_gcs_bundled_dependencies.a),-larrow_gcs_bundled_dependencies) -larrow \ | ||
| -larrow_bundled_dependencies \ | ||
| ${UTF8PROC_SNAPPY_LIBS} -lz -lzstd -llz4 -lbz2 -lole32 \ | ||
| ${MIMALLOC_LIBS} ${OPENSSL_LIBS} ${RE2_LIBS} ${AWS_LIBS} ${GCS_LIBS}" # ${AZURE_LIBS} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -200,14 +200,20 @@ download_binary <- function(lib) { | |
| # * "darwin-x86_64" | ||
| # These string values, along with `NULL`, are the potential return values of | ||
| # this function. On Windows, LIBARROW_BINARY is ignored and the binary is | ||
| # chosen by R version: "windows-x86_64-rtools40" or "windows-x86_64-rtools45". | ||
| # chosen by architecture and R version: "windows-aarch64-rtools45", | ||
| # "windows-x86_64-rtools40" or "windows-x86_64-rtools45". | ||
| identify_binary <- function( | ||
| lib = Sys.getenv("LIBARROW_BINARY"), | ||
| info = distro(), | ||
| r_version = getRversion() | ||
| r_version = getRversion(), | ||
| # The architecture R was built for, as in configure.win, not the machine's | ||
| arch = tolower(R.version$arch) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the first time we have to care about arch in here? Maybe I'm old and forgetful but don't we have to build arm and x86 for mac? |
||
| ) { | ||
| if (on_windows) { | ||
| if (VERSION_22_OR_LATER) { | ||
| if (normalise_arch(arch) == "arm64") { | ||
| return("windows-aarch64-rtools45") | ||
| } | ||
| # The binary built with Rtools45 can't be linked by Rtools43 or earlier, | ||
| # which R < 4.4 uses, so those get the one built with Rtools40. | ||
| if (package_version(r_version) < "4.4") { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is true? R version 4.6 uses Rtools45, which, as I recall from the last PR, also works for R 4.4? 😵💫
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep! I just wanted to bump it on CI so we can take advantage of binaries for dependencies so quicker builds. The toolchain is much easier to work with than the previous ones, seems to have a ton more compatibility once we clear the super old gcc versions in earlier ones. I'm guessing the reason there isn't an RTools46 because of Tomas Kalibera passing away, and nobody formally taking over his work.