Skip to content

Commit 6571561

Browse files
committed
use tinythread fallback on sparc
1 parent 2fd886d commit 6571561

File tree

4 files changed

+15
-16
lines changed

4 files changed

+15
-16
lines changed

R/build.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ tbbCxxFlags <- function() {
3737
# Return the linker flags requried for TBB on this platform
3838
tbbLdFlags <- function() {
3939
# on Windows and Solaris we need to explicitly link against tbb.dll
40-
if (Sys.info()['sysname'] %in% c("Windows", "SunOS")) {
40+
if ((Sys.info()['sysname'] %in% c("Windows", "SunOS")) && !isSparc()) {
4141
tbb <- tbbLibPath()
4242
paste("-L", asBuildPath(dirname(tbb)), " -ltbb -ltbbmalloc", sep = "")
4343
} else {
@@ -54,7 +54,7 @@ tbbLibPath <- function(suffix = "") {
5454
"Windows" = paste("tbb", suffix, ".dll", sep = ""),
5555
"SunOS" = paste("libtbb", suffix, ".so", sep = "")
5656
)
57-
if (sysname %in% names(tbbSupported)) {
57+
if ((sysname %in% names(tbbSupported)) && !isSparc()) {
5858
libDir <- "lib/"
5959
if (sysname == "Windows")
6060
libDir <- paste(libDir, .Platform$r_arch, "/", sep="")
@@ -65,6 +65,9 @@ tbbLibPath <- function(suffix = "") {
6565
}
6666
}
6767

68+
isSparc <- function() {
69+
Sys.info()['sysname'] == "SunOS" && Sys.info()[["machine"]] != "i86pc"
70+
}
6871

6972
# Helper function to ape the behavior of the R build system
7073
# when providing paths to libraries

inst/include/RcppParallel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// compatibility with CRAN packages not previously configured
1111
// to link to TBB in Makevars.win)
1212
#ifndef RCPP_PARALLEL_USE_TBB
13-
#if defined(__APPLE__) || defined(__gnu_linux__) || ((defined(__sun) && defined(__SVR4)))
13+
#if defined(__APPLE__) || defined(__gnu_linux__) || ((defined(__sun) && defined(__SVR4) && !defined(__sparc)))
1414
#define RCPP_PARALLEL_USE_TBB 1
1515
#include "RcppParallel/TBB.h"
1616
#else

src/Makevars

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ else
1717
USE_TBB=Linux
1818
endif
1919
ifeq ($(UNAME), SunOS)
20-
USE_TBB=SunOS
20+
SUNOS_ARCH = $(shell uname -p)
21+
ifeq ($(SUNOS_ARCH), i386)
22+
USE_TBB=SunOS
23+
endif
2124
endif
2225

2326
endif
@@ -49,12 +52,9 @@ endif
4952

5053
# For Solaris detect if this is 32-bit R on x86 and if so forward that to TBB
5154
ifeq ($(USE_TBB), SunOS)
52-
SUNOS_ARCH = $(shell uname -p)
53-
ifeq ($(SUNOS_ARCH), i386)
54-
R_32BIT = $(shell ${R_HOME}/bin/Rscript -e 'cat(.Machine$$sizeof.pointer == 4)')
55-
ifeq ($(R_32BIT), TRUE)
56-
MAKE_ARGS += arch=ia32
57-
endif
55+
R_32BIT = $(shell ${R_HOME}/bin/Rscript -e 'cat(.Machine$$sizeof.pointer == 4)')
56+
ifeq ($(R_32BIT), TRUE)
57+
MAKE_ARGS += arch=ia32
5858
endif
5959
endif
6060

src/tbb/build/SunOS.gcc.inc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,9 @@ ifeq (ia32,$(arch))
6363
LIB_LINK_FLAGS += -m32
6464
endif
6565

66-
# for some gcc versions on Solaris, -m64 may imply V9, but perhaps not everywhere (TODO: verify).
67-
# RcppParallel: CRAN uses 32-bit SPARC so we force that here
6866
ifeq (sparc,$(arch))
69-
CPLUS_FLAGS += -mcpu=v9 -m32
70-
LIB_LINK_FLAGS += -mcpu=v9 -m32
71-
# CPLUS_FLAGS += -mcpu=v9 -m64
72-
# LIB_LINK_FLAGS += -mcpu=v9 -m64
67+
CPLUS_FLAGS += -mcpu=v9 -m64
68+
LIB_LINK_FLAGS += -mcpu=v9 -m64
7369
endif
7470

7571
#------------------------------------------------------------------------------

0 commit comments

Comments
 (0)