Skip to content

Commit 479b6b7

Browse files
authored
Merge pull request #14509 from Mic92/no-tbb
build: Disable libstdc++ TBB backend to avoid unnecessary dependency
2 parents 3c2dcf4 + 2f3ec16 commit 479b6b7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

nix-meson-build-support/common/meson.build

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,26 @@ if cxx.get_id() == 'clang'
4242
add_project_arguments('-fpch-instantiate-templates', language : 'cpp')
4343
endif
4444

45+
# Detect if we're using libstdc++ (GCC's standard library)
46+
# libstdc++ uses Intel TBB as backend for C++17 parallel algorithms when <execution> is included.
47+
# boost::concurrent_flat_map includes <execution>, which would require linking against TBB.
48+
# Since we don't actually use parallel algorithms, disable the TBB backend to avoid the dependency.
49+
# TBB is a dependency of blake3 and leaking into our build environment.
50+
is_using_libstdcxx = cxx.compiles(
51+
'''
52+
#include <ciso646>
53+
#ifndef __GLIBCXX__
54+
#error "not libstdc++"
55+
#endif
56+
int main() { return 0; }
57+
''',
58+
name : 'using libstdc++',
59+
)
60+
61+
if is_using_libstdcxx
62+
add_project_arguments('-D_GLIBCXX_USE_TBB_PAR_BACKEND=0', language : 'cpp')
63+
endif
64+
4565
# Darwin ld doesn't like "X.Y.ZpreABCD+W"
4666
nix_soversion = meson.project_version().split('+')[0].split('pre')[0]
4767

0 commit comments

Comments
 (0)