diff --git a/devel/onetbb/Makefile b/devel/onetbb/Makefile index bceb1248f3e9..1f6c85407312 100644 --- a/devel/onetbb/Makefile +++ b/devel/onetbb/Makefile @@ -1,52 +1,52 @@ PORTNAME= onetbb DISTVERSIONPREFIX= v DISTVERSION= 2022.3.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel MAINTAINER= martymac@FreeBSD.org COMMENT= Library that provides thread building blocks WWW= https://software.intel.com/oneapi/onetbb LICENSE= APACHE20 LIB_DEPENDS= libhwloc.so:devel/hwloc2 USES= cmake:testing compiler:c++11-lang localbase:ldflags pathfix pkgconfig USE_LDCONFIG= yes USE_GITHUB= yes GH_ACCOUNT= uxlfoundation GH_PROJECT= oneTBB CONFLICTS= tbb # Many symbols in the linker version scripts are undefined because link time # optimization (-flto=thin) removes them. Suppress errors with lld >= 17 due to # these undefined symbols. LDFLAGS+= -Wl,--undefined-version # Pkgconfig: tbb.pc (on 64bit arch) vs tbb32.pc PLIST_SUB= DBGSUFX="${DBGSUFX}" \ PCSUFX="${PCSUFX}" PORTDOCS= README.md CMAKE_TESTING_ON= TBB_TEST CMAKE_OFF= TBB_STRICT \ TBB_TEST CMAKE_ARGS= -DCMAKE_INSTALL_DOCDIR:PATH="${DOCSDIR}" OPTIONS_DEFINE= DOCS .include .if defined(WITH_DEBUG) DBGSUFX= _debug .endif .if ${ARCH} == i386 || ${ARCH} == powerpc || ${ARCH:Marmv?} PCSUFX= 32 .endif .include diff --git a/devel/onetbb/files/patch-include_oneapi_tbb_detail__exception.h b/devel/onetbb/files/patch-include_oneapi_tbb_detail__exception.h new file mode 100644 index 000000000000..0299b72a06b2 --- /dev/null +++ b/devel/onetbb/files/patch-include_oneapi_tbb_detail__exception.h @@ -0,0 +1,26 @@ +Fix unsafe_wait visibility + +Fixes tests 66 and 74: + +66 - test_global_control (Subprocess aborted) +74 - test_tbb_header (Failed) + +--- include/oneapi/tbb/detail/_exception.h.orig 2025-10-29 11:31:36 UTC ++++ include/oneapi/tbb/detail/_exception.h +@@ -66,14 +66,14 @@ class TBB_EXPORT missing_wait : public std::exception + }; + + //! Exception for impossible finalization of task_sheduler_handle +-#if __APPLE__ ++#if __APPLE__ || __FreeBSD__ + #pragma GCC visibility push(default) + #endif + class TBB_EXPORT unsafe_wait : public std::runtime_error { + public: + unsafe_wait(const char* msg) : std::runtime_error(msg) {} + }; +-#if __APPLE__ ++#if __APPLE__ || __FreeBSD__ + #pragma GCC visibility pop + #endif + diff --git a/devel/onetbb/files/patch-src_tbb_co_context.h b/devel/onetbb/files/patch-src_tbb_co_context.h new file mode 100644 index 000000000000..7d46c4c2f1b0 --- /dev/null +++ b/devel/onetbb/files/patch-src_tbb_co_context.h @@ -0,0 +1,23 @@ +Fix mmap() call: MAP_STACK needs at least PROT_READ and PROT_WRITE + +Fixes tests 29, 67 and 105: + + 29 - test_resumable_tasks (SEGFAULT) + 67 - test_task (SEGFAULT) +105 - conformance_resumable_tasks (SEGFAULT) + +--- src/tbb/co_context.h.orig 2026-01-22 10:49:57 UTC ++++ src/tbb/co_context.h +@@ -310,7 +310,12 @@ inline void create_coroutine(coroutine_type& c, std::s + const std::size_t protected_stack_size = page_aligned_stack_size + 2 * REG_PAGE_SIZE; + + // Allocate the stack with protection property ++#if __FreeBSD__ ++ // MAP_STACK needs at least PROT_READ and PROT_WRITE ++ std::uintptr_t stack_ptr = (std::uintptr_t)mmap(nullptr, protected_stack_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0); ++#else + std::uintptr_t stack_ptr = (std::uintptr_t)mmap(nullptr, protected_stack_size, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0); ++#endif + __TBB_ASSERT((void*)stack_ptr != MAP_FAILED, nullptr); + + // Allow read write on our stack (guarded pages are still protected) diff --git a/devel/onetbb/files/patch-test_common_utils_concurrency_limit.h b/devel/onetbb/files/patch-test_common_utils_concurrency_limit.h new file mode 100644 index 000000000000..8d3fca822a9e --- /dev/null +++ b/devel/onetbb/files/patch-test_common_utils_concurrency_limit.h @@ -0,0 +1,24 @@ +Avoid dereferencing a NULL pointer + +Makes the following test output cleaner: + +63 - test_hw_concurrency (ILLEGAL) +(changed to) +63 - test_hw_concurrency (Subprocess aborted) + +and adds the following message: + +test/common/utils_concurrency_limit.h:380, assertion !cpuset_indices.empty(): Empty cpuset returned + +A call to get_cpuset_indices() currently always fails on FreeBSD (not implemented). + +--- test/common/utils_concurrency_limit.h.orig 2026-01-22 11:53:36 UTC ++++ test/common/utils_concurrency_limit.h +@@ -377,6 +377,7 @@ int limit_number_of_threads( int max_threads ) { + + ASSERT(max_threads <= int(sizeof(mask_t) * CHAR_BIT), "The mask size is not enough to set the requested number of threads."); + std::vector cpuset_indices = get_cpuset_indices(); ++ ASSERT(!cpuset_indices.empty(), "Empty cpuset returned."); + + for (int i = 0; i < max_threads; ++i) { + CPU_SET(cpuset_indices[i], &new_mask); diff --git a/devel/onetbb/files/patch-test_tbbmalloc_test_malloc_compliance.cpp b/devel/onetbb/files/patch-test_tbbmalloc_test_malloc_compliance.cpp new file mode 100644 index 000000000000..6d57f5a6c665 --- /dev/null +++ b/devel/onetbb/files/patch-test_tbbmalloc_test_malloc_compliance.cpp @@ -0,0 +1,17 @@ +Calling utils::LinuxKernelVersion() is only relevant on Linux + +This fixes test 131: + +131 - test_malloc_compliance (Subprocess aborted) + +--- test/tbbmalloc/test_malloc_compliance.cpp.orig 2025-10-29 11:31:36 UTC ++++ test/tbbmalloc/test_malloc_compliance.cpp +@@ -1032,7 +1032,7 @@ TEST_CASE("MAIN TEST") { + // Check if we were called to test standard behavior + // TODO: enable this mode + // setSystemAllocs(); +-#if __unix__ ++#if __linux__ + /* According to man pthreads + "NPTL threads do not share resource limits (fixed in kernel 2.6.10)". + Use per-threads limits for affected systems.