Skip to content

Commit d79144c

Browse files
authored
[cxx-interop] Prevent "header not found" errors on Linux when tbb is not installed
libstdc++9 has a dependency on the `tbb` package, which is not bundled with Ubuntu as of 20.04: `<execution>` includes `<pstl/parallel_backend_tbb.h>` which tries to include `<tbb/blocked_range.h>`. This results in compiler errors when someone is trying to use the C++ stdlib from Swift: ``` /usr/include/c++/9/pstl/parallel_backend_tbb.h:19:10: error: 'tbb/blocked_range.h' file not found ``` Let's only include `<execution>` if tbb headers are available. rdar://102151194
1 parent 8c36500 commit d79144c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

stdlib/public/Cxx/std/libstdcxx.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
#if __has_include("charconv")
1212
#include "charconv"
1313
#endif
14-
#if __has_include("execution")
14+
// <execution> includes tbb headers, which might not be installed.
15+
// Only include <execution> if tbb is installed.
16+
#if __has_include("execution") && __has_include(<tbb/blocked_range.h>)
1517
#include "execution"
1618
#endif
1719
#if __has_include("filesystem")

0 commit comments

Comments
 (0)