Skip to content

a quick and dirty way to compile R on win arm64 using clangarm64

5 messages · yu gong, Tomas Kalibera

#
hello everyone:
  On this boring weekend, I tried compile R-trunk on windows 11 arm64 using clangarm64+msys2 on macbook m1 ,  it surprisingly easy to compiled and run.
more investigation and test and code modify need to be done ,but IMO this is a good beginning !!

to compile R on windows 11 arm64 just need :
1 svn checkout R-trunk and add USE_LLVM=YES in MKRules.dist or  Mkrules.local
2 install msys2 and clangarm64 package
 mingw-w64-clang-aarch64-brotli 1.0.9-6
 mingw-w64-clang-aarch64-bzip2 1.0.8-2
 mingw-w64-clang-aarch64-c-ares 1.19.1-1
 mingw-w64-clang-aarch64-ca-certificates 20230311-1
mingw-w64-clang-aarch64-clang 16.0.5-3
mingw-w64-clang-aarch64-compiler-rt 16.0.5-3
mingw-w64-clang-aarch64-crt-git 11.0.0.r107.gd367cc9d7-1
mingw-w64-clang-aarch64-curl 8.2.1-1
mingw-w64-clang-aarch64-expat 2.5.0-1
mingw-w64-clang-aarch64-flang 16.0.5-1
mingw-w64-clang-aarch64-gettext 0.21.1-2
mingw-w64-clang-aarch64-giflib 5.2.1-3
mingw-w64-clang-aarch64-gmp 6.3.0-1
mingw-w64-clang-aarch64-gnutls 3.8.0-1
mingw-w64-clang-aarch64-headers-git 11.0.0.r107.gd367cc9d7-1
mingw-w64-clang-aarch64-icu 73.2-1
mingw-w64-clang-aarch64-jbigkit 2.1-4
mingw-w64-clang-aarch64-lerc 4.0.0-1
mingw-w64-clang-aarch64-libc++ 16.0.5-1
mingw-w64-clang-aarch64-libdeflate 1.18-1
mingw-w64-clang-aarch64-libffi 3.4.4-1
mingw-w64-clang-aarch64-libgcrypt 1.10.2-1
mingw-w64-clang-aarch64-libgpg-error 1.47-2
mingw-w64-clang-aarch64-libiconv 1.17-3
mingw-w64-clang-aarch64-libidn2 2.3.4-1
mingw-w64-clang-aarch64-libjpeg-turbo 3.0.0-1
mingw-w64-clang-aarch64-libpng 1.6.40-1
mingw-w64-clang-aarch64-libpsl 0.21.2-4
mingw-w64-clang-aarch64-libssh2 1.11.0-1
mingw-w64-clang-aarch64-libtasn1 4.19.0-1
mingw-w64-clang-aarch64-libtiff 4.5.1-2
mingw-w64-clang-aarch64-libunistring 1.1-1
mingw-w64-clang-aarch64-libunwind 16.0.5-1
mingw-w64-clang-aarch64-libwebp 1.3.1-1
mingw-w64-clang-aarch64-libwinpthread-git 11.0.0.r107.gd367cc9d7-1
mingw-w64-clang-aarch64-libxml2 2.11.4-2
mingw-w64-clang-aarch64-lld 16.0.5-3
mingw-w64-clang-aarch64-llvm 16.0.5-3
mingw-w64-clang-aarch64-llvm-libs 16.0.5-3
mingw-w64-clang-aarch64-make 4.4-2
mingw-w64-clang-aarch64-mlir 16.0.5-1
mingw-w64-clang-aarch64-nettle 3.9.1-1
mingw-w64-clang-aarch64-nghttp2 1.55.1-1
mingw-w64-clang-aarch64-openblas 0.3.23-1
mingw-w64-clang-aarch64-openmp 16.0.5-1
mingw-w64-clang-aarch64-openssl 3.1.2-1
mingw-w64-clang-aarch64-p11-kit 0.25.0-1
mingw-w64-clang-aarch64-pcre2 10.42-1
mingw-w64-clang-aarch64-readline 8.2.001-6
mingw-w64-clang-aarch64-rtmpdump 2.4.r99.f1b83c1-1
mingw-w64-clang-aarch64-tcl 8.6.12-2
mingw-w64-clang-aarch64-termcap 1.3.1-6
mingw-w64-clang-aarch64-tk 8.6.12-2
mingw-w64-clang-aarch64-wineditline 2.206-1
mingw-w64-clang-aarch64-winpthreads-git 11.0.0.r107.gd367cc9d7-1
mingw-w64-clang-aarch64-xz 5.4.4-1
mingw-w64-clang-aarch64-zlib 1.2.13-3
mingw-w64-clang-aarch64-zstd 1.5.5-1

3 cd r/src/gnuwin32
  make

In next week,  will try more mod for win11 arm64

Yu Gong
#
sorry forgot dynamic link  ICU
1 svn checkout R-trunk and add USE_LLVM=YES and ICU_LIBS ?= -licuin -licuuc -licudt -lstdc++  in MKRules.dist or  Mkrules.local
#
On 8/13/23 05:14, yu gong wrote:
Well, yes, R-devel builds with clang/flang also for Windows/aarch64. 
I've committed this option (USE_LLVM) last week together with other 
required changes, but it is still work in progress, not documented nor 
well tested.? I have created for this a (subset) of Rtools43 for aarch64 
(available at https://www.r-project.org/nosvn/winutf8/ucrt3/). This goes 
together with efforts of Brian Ripley and CRAN to make CRAN packages 
work with flang.

If you are interested in R on Windows/aarch64, stay tuned. But what I 
have already allows to build R-devel with base and recommended packages 
and to pass check-all, yet still requires some cleanups. R still needs 
to be taught about the new architecture in some places, particularly in 
the package management, now it still thinks it is x64. I've not yet 
gotten to testing any other R packages.

If you were interested in helping out, one thing missing is several 
Rtools43 (MXE) packages that don't yet build with clang for aarch64 
(ping me for details if you are interested).

Best,
Tomas
#
> I have created for this a (subset) of Rtools43 for >aarch64 (available at https://www.r->project.org/nosvn/winutf8/ucrt3/).
fantastic, will try this toolchain.
definitely, will try build these packages .
Looking forward R for windows arm64 . yes, R on aarch64 still think it is x64 , navie grep source code shows: makefiles,some library  R codes and c codes  and installer codes are affected , need to be tuned.
definitely, will try build these packages .

regards
Yu
#
On 8/13/23 05:26, yu gong wrote:
For the record, if you are experimenting with building R-devel using 
msys2 toolchains, you should also remove various _STATIC macros from the 
make files (as you are linking dynamically).

There is a document I wrote with more details 
(https://developer.r-project.org/WindowsBuilds/winutf8/winutf8.html). It 
is very outdated, but at least this part still applies, and points to a 
patch: https://developer.r-project.org/WindowsBuilds/winutf8/nostatic.diff

Dynamic linking against third party libraries on Windows is not 
officially supported by R. This is only useful for experimenting, e.g. 
for testing R code on compilers available in msys2 but not yet in Rtools 
(and I have done that myself with Windows/aarch64 before building Rtools 
for the platform).

Tomas