Skip to content

Commit 7fcf9da

Browse files
committed
support aarch64 on Windows
Adapted from a patch shared by Tomas Kalibera.
1 parent 02b86ca commit 7fcf9da

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

R/tbb.R

+4
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ tbbLdFlags <- function() {
8181
return(sprintf(fmt, asBuildPath(tbbLib)))
8282
}
8383

84+
# on Aarch64 builds, use the version of TBB provided by Rtools
85+
if (is_windows() &&R.version$arch=="aarch64")
86+
return("-ltbb12 -ltbbmalloc")
87+
8488
# on Mac, Windows and Solaris, we need to explicitly link (#206)
8589
needsExplicitFlags<- is_mac() || is_windows() || (is_solaris() &&!is_sparc())
8690
if (needsExplicitFlags) {

R/zzz.R

+5-1
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@ loadTbbLibrary <- function(name) {
2727

2828
.onLoad<-function(libname, pkgname) {
2929

30+
tbbLibraryName<-"tbb"
31+
if (is_windows() &&R.version$arch=="aarch64")
32+
tbbLibraryName<-"tbb12"
33+
3034
# load tbb, tbbmalloc
31-
.tbbDllInfo<<- loadTbbLibrary("tbb")
35+
.tbbDllInfo<<- loadTbbLibrary(tbbLibraryName)
3236
.tbbMallocDllInfo<<- loadTbbLibrary("tbbmalloc")
3337

3438
# load tbbmalloc_proxy, but only if requested

src/Makevars.in

+8
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ ifeq ($(USE_TBB), Windows)
8888
# Linker needs access to the tbb dll; otherwise you get errors such as:
8989
# "undefined reference to `tbb::task_scheduler_init::terminate()'"
9090
PKG_LIBS += -Ltbb/build/lib_release -ltbb -ltbbmalloc
91+
92+
# override for aarch64 (experimental) to use Rtools TBB
93+
ARCH=$(shell "${R_HOME}/bin/R" --vanilla -s -e 'cat(R.version$$arch)')
94+
ifeq "$(ARCH)" "aarch64"
95+
TBB_LIB = ${R_TOOLS_SOFT}
96+
TBB_INC = ${R_TOOLS_SOFT}
97+
PKG_LIBS = -ltbb12 -ltbbmalloc
98+
endif
9199

92100
endif
93101

0 commit comments

Comments
 (0)
close