Skip to content

Commit

Permalink
Merge pull request #207 from jeroen/macos-strict
Browse files Browse the repository at this point in the history
Fix strict linking on MacOS
  • Loading branch information
kevinushey authored Jan 4, 2024
2 parents 6f81716 + 6dccebe commit e5468c0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions R/platform.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ is_windows <- function() {
.Platform$OS.type == "windows"
}

is_mac <- function() {
Sys.info()[["sysname"]] == "Darwin"
}

is_unix <- function() {
.Platform$OS.type == "unix"
}
Expand Down
4 changes: 2 additions & 2 deletions R/tbb.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ tbbLdFlags <- function() {
return(sprintf(fmt, asBuildPath(tbbLib)))
}

# on Windows and Solaris, we need to explicitly link
needsExplicitFlags <- is_windows() || (is_solaris() && !is_sparc())
# on Mac, Windows and Solaris, we need to explicitly link (#206)
needsExplicitFlags <- is_mac() || is_windows() || (is_solaris() && !is_sparc())
if (needsExplicitFlags) {
libPath <- asBuildPath(tbbLibraryPath())
libFlag <- paste0("-L", libPath)
Expand Down
5 changes: 5 additions & 0 deletions src/Makevars.in
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ ifneq (@COMPILER@, )
MAKE_ARGS += compiler=@COMPILER@
endif

# When TBB_LIB is unset on MacOS, link to the bundled version (#206)
ifeq ($(USE_TBB)$(TBB_LIB),Mac)
PKG_LIBS += -Ltbb/build/lib_release -ltbb -Wl,-rpath,'@loader_path/../lib'
endif

# For Solaris detect if this is 32-bit R on x86 and if so forward that to TBB
ifeq ($(USE_TBB), SunOS)
R_32BIT = $(shell ${R_HOME}/bin/Rscript -e 'cat(.Machine$$sizeof.pointer == 4)')
Expand Down

0 comments on commit e5468c0

Please sign in to comment.