Skip to content

Commit e5468c0

Browse files
authored
Merge pull request #207 from jeroen/macos-strict
Fix strict linking on MacOS
2 parents 6f81716 + 6dccebe commit e5468c0

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

R/platform.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ is_windows <- function() {
33
.Platform$OS.type == "windows"
44
}
55

6+
is_mac <- function() {
7+
Sys.info()[["sysname"]] == "Darwin"
8+
}
9+
610
is_unix <- function() {
711
.Platform$OS.type == "unix"
812
}

R/tbb.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ tbbLdFlags <- function() {
8181
return(sprintf(fmt, asBuildPath(tbbLib)))
8282
}
8383

84-
# on Windows and Solaris, we need to explicitly link
85-
needsExplicitFlags <- is_windows() || (is_solaris() && !is_sparc())
84+
# on Mac, Windows and Solaris, we need to explicitly link (#206)
85+
needsExplicitFlags <- is_mac() || is_windows() || (is_solaris() && !is_sparc())
8686
if (needsExplicitFlags) {
8787
libPath <- asBuildPath(tbbLibraryPath())
8888
libFlag <- paste0("-L", libPath)

src/Makevars.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ ifneq (@COMPILER@, )
9595
MAKE_ARGS += compiler=@COMPILER@
9696
endif
9797

98+
# When TBB_LIB is unset on MacOS, link to the bundled version (#206)
99+
ifeq ($(USE_TBB)$(TBB_LIB),Mac)
100+
PKG_LIBS += -Ltbb/build/lib_release -ltbb -Wl,-rpath,'@loader_path/../lib'
101+
endif
102+
98103
# For Solaris detect if this is 32-bit R on x86 and if so forward that to TBB
99104
ifeq ($(USE_TBB), SunOS)
100105
R_32BIT = $(shell ${R_HOME}/bin/Rscript -e 'cat(.Machine$$sizeof.pointer == 4)')

0 commit comments

Comments
 (0)