Skip to content

enable tbb by default on musl-based linux (e.g. alpine)#263

Merged
kevinushey merged 1 commit into
masterfrom
enable-tbb-on-musl
Jul 24, 2026
Merged

enable tbb by default on musl-based linux (e.g. alpine)#263
kevinushey merged 1 commit into
masterfrom
enable-tbb-on-musl

Conversation

@kevinushey

Copy link
Copy Markdown
Contributor

Fixes #231.

RcppParallel.h gated the default RCPP_PARALLEL_USE_TBB on __gnu_linux__, a glibc-only predefined macro. musl-based systems such as Alpine define __linux__ but not __gnu_linux__, so the default fell through to 0 — disabling TBB for any downstream package that doesn't pass -DRCPP_PARALLEL_USE_TBB explicitly (i.e. doesn't use RcppParallel::CxxFlags() in its Makevars), even when RcppParallel itself was built with a working TBB.

This matches packages like FLSSS and evesim still failing on Alpine in #231 despite 6.0.0 emitting the flag from CxxFlags() (which fixed only the packages that do use it, e.g. bgms).

Fix

Match Linux via __linux__, which covers both glibc and musl:

# if defined(__APPLE__) || defined(__linux__) || (defined(__sun) && defined(__SVR4) && !defined(__sparc))

Consistent with the bundled TBB sources, which use __linux__ broadly and only guard on __GLIBC__ where glibc-specific behavior is required. On glibc Linux the header already defaulted to 1 regardless of build-time TBB status, so this introduces no new mismatch — it just brings musl in line with every other Linux.

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
@kevinushey
kevinushey merged commit 8499253 into master Jul 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RcppParallel.h disables TBB on Alpine Linux

1 participant