Skip to content

Commit 8499253

Browse files
authored
enable tbb by default on musl-based linux (e.g. alpine) (#263)
RcppParallel.h gated the default RCPP_PARALLEL_USE_TBB on __gnu_linux__, a glibc-only predefined macro. On musl-based systems such as Alpine, which define __linux__ but not __gnu_linux__, the default fell through to 0 -- disabling TBB for any downstream package that does not pass -DRCPP_PARALLEL_USE_TBB explicitly (i.e. does not use RcppParallel::CxxFlags() in its Makevars), even when RcppParallel itself was built with a working TBB. Match Linux via __linux__ instead, which covers both glibc and musl. This is consistent with the bundled TBB sources, which use __linux__ broadly and only guard on __GLIBC__ where glibc-specific behavior is required. Fixes #231
1 parent 77684de commit 8499253

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

inst/include/RcppParallel.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99
// (NOTE: Windows TBB is temporarily opt-in for packages for
1010
// compatibility with CRAN packages not previously configured
1111
// to link to TBB in Makevars.win)
12+
// NOTE: match Linux via __linux__ rather than __gnu_linux__; the latter is
13+
// only defined by glibc toolchains, which left TBB disabled by default on
14+
// musl-based systems such as Alpine Linux (https://github.com/RcppCore/RcppParallel/issues/231)
1215
#ifndef RCPP_PARALLEL_USE_TBB
13-
# if defined(__APPLE__) || defined(__gnu_linux__) || (defined(__sun) && defined(__SVR4) && !defined(__sparc))
16+
# if defined(__APPLE__) || defined(__linux__) || (defined(__sun) && defined(__SVR4) && !defined(__sparc))
1417
# define RCPP_PARALLEL_USE_TBB 1
1518
# else
1619
# define RCPP_PARALLEL_USE_TBB 0

0 commit comments

Comments
 (0)