diff --git a/meta-oe/recipes-support/tbb/files/0001-test-Skip-conformance_resumable_tasks-when-resumable.patch b/meta-oe/recipes-support/tbb/files/0001-test-Skip-conformance_resumable_tasks-when-resumable.patch new file mode 100644 index 0000000000..ea36dc5b24 --- /dev/null +++ b/meta-oe/recipes-support/tbb/files/0001-test-Skip-conformance_resumable_tasks-when-resumable.patch @@ -0,0 +1,27 @@ +From: Khem Raj +Subject: [PATCH] test: Skip conformance_resumable_tasks when resumable tasks are disabled + +The library only enables resumable tasks when __TBB_RESUMABLE_TASKS is +set, which excludes Linux with a C library other than glibc (e.g. musl). +test_resumable_tasks.cpp checks that macro, but the conformance test +repeats an older list of platforms and fails to build on musl: + + conformance_resumable_tasks.cpp:39:5: error: no member named 'suspend' in namespace 'tbb::task' + +Use __TBB_RESUMABLE_TASKS instead, keeping the WINAPI_FAMILY exclusion. + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- +--- a/test/conformance/conformance_resumable_tasks.cpp ++++ b/test/conformance/conformance_resumable_tasks.cpp +@@ -17,8 +17,7 @@ + + #include "common/test.h" + +-#if (!__TBB_WIN8UI_SUPPORT && !defined(WINAPI_FAMILY) && !__ANDROID__ \ +- && !__QNX__) ++#if __TBB_RESUMABLE_TASKS && !defined(WINAPI_FAMILY) + + #include "oneapi/tbb/task.h" + #include "oneapi/tbb/task_group.h" diff --git a/meta-oe/recipes-support/tbb/files/0002-test-malloc_overload-Only-use-glibc-malloc-extension.patch b/meta-oe/recipes-support/tbb/files/0002-test-malloc_overload-Only-use-glibc-malloc-extension.patch new file mode 100644 index 0000000000..3675a68f2b --- /dev/null +++ b/meta-oe/recipes-support/tbb/files/0002-test-malloc_overload-Only-use-glibc-malloc-extension.patch @@ -0,0 +1,57 @@ +From: Khem Raj +Subject: [PATCH] test: malloc_overload: Only use glibc malloc extensions where available + +mallopt(), mallinfo() and pvalloc() are GNU extensions that musl does not +provide, so test_malloc_overload fails to build there: + + test_malloc_overload.cpp:401:13: error: use of undeclared identifier 'mallopt' + test_malloc_overload.cpp:451:18: error: use of undeclared identifier 'pvalloc'; did you mean 'valloc'? + test_malloc_overload.cpp:466:21: error: variable has incomplete type 'struct mallinfo' + +Only test them on glibc (and Android for mallopt()/mallinfo()), matching +the guard tbbmalloc_proxy already uses for its mallinfo() override. + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- +--- a/test/tbbmalloc/test_malloc_overload.cpp ++++ b/test/tbbmalloc/test_malloc_overload.cpp +@@ -53,7 +53,9 @@ + #endif + + #define __TBB_POSIX_MEMALIGN_PRESENT (__unix__ && !__ANDROID__) || __APPLE__ +-#define __TBB_PVALLOC_PRESENT __unix__ && !__ANDROID__ ++#define __TBB_PVALLOC_PRESENT __unix__ && !__ANDROID__ && __GLIBC__ ++// mallopt() and mallinfo() are not provided by every C library, e.g. musl ++#define __TBB_MALLOPT_MALLINFO_PRESENT __unix__ && (__GLIBC__ || __ANDROID__) + #if __GLIBC__ + // aligned_alloc available since GLIBC 2.16 + #define __TBB_ALIGNED_ALLOC_PRESENT __GLIBC_PREREQ(2, 16) +@@ -397,9 +399,9 @@ + //! Testing tbbmalloc_proxy overload capabilities + //! \brief \ref error_guessing + TEST_CASE("Main set of tests") { +-#if __unix__ ++#if __TBB_MALLOPT_MALLINFO_PRESENT + REQUIRE(mallopt(0, 0)); // add dummy mallopt call for coverage +-#endif // __unix__ ++#endif // __TBB_MALLOPT_MALLINFO_PRESENT + + void *ptr = nullptr; + utils::suppress_unused_warning(ptr); // for android +@@ -456,6 +458,7 @@ + CheckMemalignFuncOverload(aligned_alloc, free); + #endif + ++#if __TBB_MALLOPT_MALLINFO_PRESENT + #if __INTEL_COMPILER + #pragma warning(push) + #pragma warning(disable: 1478) +@@ -473,6 +476,7 @@ + REQUIRE((!info.arena && !info.ordblks && !info.smblks && !info.hblks + && !info.hblkhd && !info.usmblks && !info.fsmblks + && !info.uordblks && !info.fordblks && !info.keepcost)); ++#endif // __TBB_MALLOPT_MALLINFO_PRESENT + + #if !__ANDROID__ + // These non-standard functions are exported by GLIBC, and might be used diff --git a/meta-oe/recipes-support/tbb/tbb_2023.1.0.bb b/meta-oe/recipes-support/tbb/tbb_2023.1.0.bb index 8f48412fb6..08f6ddcfd2 100644 --- a/meta-oe/recipes-support/tbb/tbb_2023.1.0.bb +++ b/meta-oe/recipes-support/tbb/tbb_2023.1.0.bb @@ -16,6 +16,8 @@ BRANCH = "onetbb_2023" SRCREV = "3046c8b0c29df995980003ea24f4d78c80ec0c8d" SRC_URI = "git://github.com/oneapi-src/oneTBB.git;protocol=https;branch=${BRANCH} \ file://run-ptest \ + file://0001-test-Skip-conformance_resumable_tasks-when-resumable.patch \ + file://0002-test-malloc_overload-Only-use-glibc-malloc-extension.patch \ " LDFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}"