Skip to content

[R][CI] Build the Windows libarrow binary with Rtools45 instead of Rtools40 #55398

Open

Description

@thisisnic

@nealrichardson - I wrote the below with Claude based on our chat and my chat with Jeroen - does this look like a reasonable experiment to try to make sure we don't need anything more complex?


Describe the enhancement requested

The Windows libarrow static library that r/configure.win downloads for every R user is built in CI with Rtools40 (ci/scripts/r_windows_build.sh, ci/scripts/PKGBUILD, the windows-cpp job in .github/workflows/r.yml, and the r-binary-packages crossbow task). Rtools40 is now archived: CRAN moved its installer to cran-archive.r-project.org on 2026-10-30, which broke both jobs (#55377), and its pacman package repository is no longer maintained. R 4.5 and later use Rtools45, which is MXE-based and has no package manager, so the current build script cannot run there as-is.

Most of what libarrow needs is already bundled by the Arrow CMake build (Thrift, AWS SDK, Brotli, google-cloud-cpp, abseil, protobuf, mimalloc; the last three only because rtools40 doesn't have them and AUTO falls back to bundling). Of the eight libraries PKGBUILD takes from the toolchain, Rtools45 ships six (zlib, zstd, lz4, bzip2, curl, re2), plus the OpenSSL and nghttp2 that the build script copies into the zip. The two it lacks, snappy and utf8proc, can be built with Snappy_SOURCE=BUNDLED and utf8proc_SOURCE=BUNDLED. I checked this against the rtools45-toolchain-libs-full-6768 tarballs for both x86_64 and aarch64; the library sets match for everything Arrow uses.

Proposed change:

  • Install Rtools45 in the windows-cpp job and call cmake directly instead of makepkg-mingw, with CMAKE_PREFIX_PATH pointing at the Rtools45 toolchain directory.
  • Bundle snappy, utf8proc and re2. Rtools45's re2 (2025-08-12) depends on abseil, so linking it from configure.win would need the absl_* libraries on the link line; bundling is simpler.
  • Update the hard-coded link flags in r/configure.win: drop -lsnappy -lutf8proc -lre2, and extend GCS_LIBS with the transitive dependencies of Rtools45's curl 8.18 (libidn2, libpsl, libunistring, libiconv, libssh2, libgcrypt, libgpg-error, brotli).
  • Force-include a small compatibility header defining the BCRYPT_*_ALG_HANDLE constants. Rtools45 ships mingw-w64 11.0.1 headers, and its bcrypt.h does not define the algorithm pseudo-handles that the bundled google-cloud-cpp uses in google/cloud/internal/win32/, so the GCS build fails without them. r-windows/ucrt-libs carries the same four-define workaround in its Arrow recipe.
  • Pass absl_SOURCE=BUNDLED and Protobuf_SOURCE=BUNDLED explicitly. Rtools45 ships abseil 20250127 and protobuf 29.5; with CMAKE_PREFIX_PATH pointing at the toolchain, AUTO would pick those up instead of the versions Arrow bundles (abseil 20260817), and whether the bundled google-cloud-cpp 3.2.0 and re2 build against the older ones is untested. Forcing bundled keeps the dependency set the same as today.
  • Update the crossbow task once the main workflow is green.

Windows aarch64 is a follow-up, not part of this issue: the Rtools45 aarch64 toolchain has the same libraries, but #52022 (xsimd) and #50612 need resolving first.

This issue was drafted with the help of an AI assistant.

Component(s)

Continuous Integration, R

Activity

  1. nealrichardson commented on Nov 4, 2026

    @nealrichardson
    Member

    Yeah that's what I was thinking. I don't see any fundamental reason why it can't work, but the only way we'll find out is by trying.

  2. thisisnic commented on Nov 5, 2026

    @thisisnic
    MemberAuthor

    CC @jeroen - after our chat yesterday, I discussed this with Neal, who has a better understanding of these internals than me, and he suggested that there might be a simpler path to updating building Arrow on Windows, which I'm going to have a look into after LatinR

  3. jeroen commented on Nov 5, 2026

    @jeroen
    Contributor

    OK sounds good. Let me know if you need any help. FWIW I am currently using this recipe and an msys2 based toolchain that is compatible with rtools45: https://github.com/r-windows/ucrt-libs/blob/master/mingw-w64-arrow/PKGBUILD

  4. thisisnic commented on Nov 13, 2026

    @thisisnic
    MemberAuthor

    Thanks @jeroen. After our chat yesterday, I think the "minimal disruption, maximal support" version of this plus #50612 will need us to make these changes:

    • build with RTools45 as the default on normal (per-PR) CI instead of the current RTools40
    • nightlies - update the r-binary-packages job to include:
      • Rtools45 x86_64
      • Rtools45 aarch64 (on a windows-11-arm runner)
      • Rtools40 x86_64
      • a test job on R 4.2 using the Rtools40 zip
      • a test job on R release on arm64 using the aarch64 zip
    • binaries: in addition to Rtools40 x86_64, we also distribute Rtools45 x86_64 and Rtools45 aarch64 (also will need to update the logic which determines which binary to select)

    This allows us to keep supporting R versions back to 4.2 on Windows. We don't want to upgrade RTools from 40 to 42, because there was a move from msys2 to MXE there which ended up with older versions of OpenSSL and curl. We could consider upgrading from 40 to 43 in April when we bump the minimum R version supported to 4.3.

    @nealrichardson or @jonkeane - before I make a start on this, how does this sound?

  5. nealrichardson commented on Nov 13, 2026

    @nealrichardson
    Member

    Makes sense, sounds like how we used to do it, building for multiple Rtools toolchains--I'm old enough to remember when Rtools40 was the new thing 👴

  6. jeroen commented on Nov 13, 2026

    @jeroen
    Contributor

    This sounds good to me, let me know if you need help. Just to summarize the core issue: rtools42 - rtools45 are built on MXE instead of MSYS2 and therefore cannot use the existing PKGBUILD file that is used in our CI. Also some dependencies might be missing from the toolchain bundle so these might need to use the bundled version now.

    As I mentioned to Nic yesterday, would recommend to build with rtools45 which is available on both intel and arm, and includes recent g++ and openssl so that should get us settled for upcoming years. You could keep the rtools40 legacy thing alive on a best-effort basis but the g++/openssl in there are quite old so I imagine at some point you need to retire it anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions