TBB: bump, castrated oldrecipe , switch to cmake (#5577)

* TBB: bump, castrated oldrecipe , switch to cmake

* resolve conflict

* tbb 2021.1.1, small fixes to build the testscases and detection of hwloc

---------

Co-authored-by: Schrijvers Luc <begasus@gmail.com>
This commit is contained in:
extrowerk
2024-06-24 13:31:55 +02:00
committed by GitHub
parent 713f7d422d
commit c4309c370f
2 changed files with 318 additions and 0 deletions

View File

@@ -0,0 +1,217 @@
From 3b411c5c672892b0e4bc0d461bb7fce52dc9416f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Wed, 6 Jan 2021 11:20:09 +0100
Subject: Haiku patches
diff --git a/cmake/compilers/Clang.cmake b/cmake/compilers/Clang.cmake
index 7894312..ffb994a 100644
--- a/cmake/compilers/Clang.cmake
+++ b/cmake/compilers/Clang.cmake
@@ -23,7 +23,9 @@ if (CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
set(TBB_COMMON_COMPILE_FLAGS -mrtm)
endif()
+if (NOT HAIKU)
set(TBB_COMMON_LINK_LIBS dl)
+endif()
set(TBB_WARNING_SUPPRESS -Wno-non-virtual-dtor -Wno-dangling-else)
if (ANDROID_PLATFORM)
diff --git a/cmake/compilers/GNU.cmake b/cmake/compilers/GNU.cmake
index 9bff049..36e7913 100644
--- a/cmake/compilers/GNU.cmake
+++ b/cmake/compilers/GNU.cmake
@@ -22,7 +22,9 @@ if (CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
set(TBB_COMMON_COMPILE_FLAGS -mrtm)
endif()
+if (NOT HAIKU)
set(TBB_COMMON_LINK_LIBS dl)
+endif()
if (NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL Intel)
# gcc 6.0 and later have -flifetime-dse option that controls elimination of stores done outside the object lifetime
diff --git a/include/oneapi/tbb/detail/_config.h b/include/oneapi/tbb/detail/_config.h
index 767a258..e459c2d 100644
--- a/include/oneapi/tbb/detail/_config.h
+++ b/include/oneapi/tbb/detail/_config.h
@@ -247,7 +247,7 @@
#define __TBB_CPP17_ALLOCATOR_IS_ALWAYS_EQUAL_PRESENT (__TBB_LANG >= 201703L)
#define __TBB_CPP17_IS_SWAPPABLE_PRESENT (__TBB_LANG >= 201703L)
-#define __TBB_RESUMABLE_TASKS (!__TBB_WIN8UI_SUPPORT && !__ANDROID__)
+#define __TBB_RESUMABLE_TASKS (!__TBB_WIN8UI_SUPPORT && !__ANDROID__ && !__HAIKU__)
/* This macro marks incomplete code or comments describing ideas which are considered for the future.
* See also for plain comment with TODO and FIXME marks for small improvement opportunities.
@@ -424,6 +424,11 @@
#define TBB_ALLOCATOR_TRAITS_BROKEN 1
#endif
+// HAIKU build fix
+#if defined(__HAIKU__)
+ #define TBB_ALLOCATOR_TRAITS_BROKEN 1
+#endif
+
// GCC 4.8 C++ standard library implements std::this_thread::yield as no-op.
#if __TBB_GLIBCXX_VERSION >= 40800 && __TBB_GLIBCXX_VERSION < 40900
#define __TBB_GLIBCXX_THIS_THREAD_YIELD_BROKEN 1
diff --git a/src/tbb/allocator.cpp b/src/tbb/allocator.cpp
index 84cf929..edfa88f 100644
--- a/src/tbb/allocator.cpp
+++ b/src/tbb/allocator.cpp
@@ -95,7 +95,7 @@ static const dynamic_link_descriptor MallocLinkTable[] = {
#define MALLOCLIB_NAME "tbbmalloc" DEBUG_SUFFIX ".dll"
#elif __APPLE__
#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".dylib"
-#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __sun || _AIX || __ANDROID__
+#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __sun || _AIX || __ANDROID__ || __HAIKU__
#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".so"
#elif __linux__ // Note that order of these #elif's is important!
#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".so.2"
diff --git a/src/tbb/dynamic_link.cpp b/src/tbb/dynamic_link.cpp
index 0b30546..5f97e16 100644
--- a/src/tbb/dynamic_link.cpp
+++ b/src/tbb/dynamic_link.cpp
@@ -387,7 +387,11 @@ namespace r1 {
#endif /* !__TBB_DYNAMIC_LOAD_ENABLED */
// RTLD_GLOBAL - to guarantee that old TBB will find the loaded library
// RTLD_NOLOAD - not to load the library without the full path
- library_handle = dlopen(library, RTLD_LAZY | RTLD_GLOBAL | RTLD_NOLOAD);
+ #ifndef __HAIKU__
+ library_handle = dlopen(library, RTLD_LAZY | RTLD_GLOBAL | RTLD_NOLOAD);
+ #else
+ library_handle = dlopen(library, RTLD_LAZY | RTLD_GLOBAL);
+ #endif
#endif /* _WIN32 */
if (library_handle) {
if (!resolve_symbols(library_handle, descriptors, required)) {
diff --git a/src/tbb/rml_tbb.cpp b/src/tbb/rml_tbb.cpp
index bcb9929..f5c282c 100644
--- a/src/tbb/rml_tbb.cpp
+++ b/src/tbb/rml_tbb.cpp
@@ -52,7 +52,7 @@ namespace rml {
#define RML_SERVER_NAME "libirml" DEBUG_SUFFIX ".dylib"
#elif __linux__
#define RML_SERVER_NAME "libirml" DEBUG_SUFFIX ".so.1"
-#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __sun || _AIX
+#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __sun || _AIX || __HAIKU__
#define RML_SERVER_NAME "libirml" DEBUG_SUFFIX ".so"
#else
#error Unknown OS
diff --git a/src/tbbmalloc/frontend.cpp b/src/tbbmalloc/frontend.cpp
index 8f97213..4f331ec 100644
--- a/src/tbbmalloc/frontend.cpp
+++ b/src/tbbmalloc/frontend.cpp
@@ -757,7 +757,7 @@ static inline unsigned int highestBitPos(unsigned int n)
unsigned int pos;
#if __ARCH_x86_32||__ARCH_x86_64
-# if __linux__||__APPLE__||__FreeBSD__||__NetBSD__||__OpenBSD__||__sun||__MINGW32__
+# if __linux__||__APPLE__||__FreeBSD__||__NetBSD__||__OpenBSD__||__sun||__MINGW32__||__HAIKU__
__asm__ ("bsr %1,%0" : "=r"(pos) : "r"(n));
# elif (_WIN32 && (!_WIN64 || __INTEL_COMPILER))
__asm
diff --git a/src/tbbmalloc/tbbmalloc.cpp b/src/tbbmalloc/tbbmalloc.cpp
index d6345ea..df59736 100644
--- a/src/tbbmalloc/tbbmalloc.cpp
+++ b/src/tbbmalloc/tbbmalloc.cpp
@@ -42,7 +42,7 @@ namespace internal {
#define MALLOCLIB_NAME "tbbmalloc" DEBUG_SUFFIX ".dll"
#elif __APPLE__
#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".dylib"
-#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __sun || _AIX || __ANDROID__
+#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __sun || _AIX || __ANDROID__ || __HAIKU__
#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".so"
#elif __linux__
#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX __TBB_STRING(.so.2)
diff --git a/test/common/memory_usage.h b/test/common/memory_usage.h
index 88b5f2d..463845c 100644
--- a/test/common/memory_usage.h
+++ b/test/common/memory_usage.h
@@ -119,7 +119,8 @@ namespace utils {
ASSERT(status == KERN_SUCCESS, NULL);
return info.virtual_size - shared_size;
#else
- return 0;
+ utils::suppress_unused_warning(stat);
+ return 0;
#endif
}
diff --git a/test/common/utils_dynamic_libs.h b/test/common/utils_dynamic_libs.h
index acac809..95e7519 100644
--- a/test/common/utils_dynamic_libs.h
+++ b/test/common/utils_dynamic_libs.h
@@ -43,7 +43,7 @@ namespace utils {
#if __APPLE__
#define EXT ".dylib"
// Android SDK build system does not support .so file name versioning
-#elif __FreeBSD__ || __NetBSD__ || __sun || _AIX || __ANDROID__
+#elif __FreeBSD__ || __NetBSD__ || __sun || _AIX || __ANDROID__ || __HAIKU__
#define EXT ".so"
#elif __linux__ // Order of these elif's matters!
#define EXT __TBB_STRING(.so.2)
diff --git a/test/conformance/conformance_resumable_tasks.cpp b/test/conformance/conformance_resumable_tasks.cpp
index 637c413..7fb704c 100644
--- a/test/conformance/conformance_resumable_tasks.cpp
+++ b/test/conformance/conformance_resumable_tasks.cpp
@@ -16,7 +16,7 @@
#include "common/test.h"
-#if (!__TBB_WIN8UI_SUPPORT && !defined(WINAPI_FAMILY) && !__ANDROID__)
+#if (!__TBB_WIN8UI_SUPPORT && !defined(WINAPI_FAMILY) && !__ANDROID__ && !__HAIKU__)
#include "oneapi/tbb/task.h"
#include "oneapi/tbb/task_group.h"
--
2.45.1
From 9a452f3f5a9c55851b2ea1cbc38a0e67150155fa Mon Sep 17 00:00:00 2001
From: Schrijvers Luc <begasus@gmail.com>
Date: Mon, 24 Jun 2024 07:27:44 +0200
Subject: Fix for undeclared abort()
diff --git a/test/common/utils_assert.h b/test/common/utils_assert.h
index 958a267..c5523b1 100644
--- a/test/common/utils_assert.h
+++ b/test/common/utils_assert.h
@@ -17,6 +17,8 @@
#ifndef __TBB_test_common_utils_assert_H
#define __TBB_test_common_utils_assert_H
+#include <cstdlib>
+
#include "utils_report.h"
#define REPORT_FATAL_ERROR REPORT
--
2.45.1
From f7b9ac14046e14ec648a518439c2c221c2f01530 Mon Sep 17 00:00:00 2001
From: Schrijvers Luc <begasus@gmail.com>
Date: Mon, 24 Jun 2024 08:11:54 +0200
Subject: Disable some warnings turning into errors for the test cases
diff --git a/cmake/compilers/GNU.cmake b/cmake/compilers/GNU.cmake
index 36e7913..66dc9eb 100644
--- a/cmake/compilers/GNU.cmake
+++ b/cmake/compilers/GNU.cmake
@@ -14,7 +14,7 @@
set(TBB_LINK_DEF_FILE_FLAG -Wl,--version-script=)
set(TBB_DEF_FILE_PREFIX lin${TBB_ARCH})
-set(TBB_WARNING_LEVEL -Wall -Wextra $<$<BOOL:${TBB_STRICT}>:-Werror> -Wfatal-errors)
+set(TBB_WARNING_LEVEL -Wall -Wextra $<$<BOOL:${TBB_STRICT}>:-Werror> -Wfatal-errors -Wno-error=uninitialized -Wno-error=array-bounds -Wno-error=use-after-free -Wno-error=address -Wno-error=sizeof-array-div)
set(TBB_TEST_WARNING_FLAGS -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor)
set(TBB_MMD_FLAG -MMD)
--
2.45.1

View File

@@ -0,0 +1,101 @@
SUMMARY="High level abstract threading library"
DESCRIPTION="Threading Building Blocks (TBB) is a C++ template library \
developed by Intel for parallel programming on multi-core processors. Using \
TBB, a computation is broken down into tasks that can run in parallel. The \
library manages and schedules threads to execute these tasks."
HOMEPAGE="https://www.threadingbuildingblocks.org/"
COPYRIGHT="2005-2021 Intel Corporation"
LICENSE="Apache v2"
REVISION="1"
SOURCE_URI="https://github.com/oneapi-src/oneTBB/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="b182c73caaaabc44ddc5ad13113aca7e453af73c1690e4061f71dfe4935d74e8"
SOURCE_DIR="oneTBB-$portVersion"
PATCHES="tbb-$portVersion.patchset"
ARCHITECTURES="?all !x86_gcc2"
SECONDARY_ARCHITECTURES="?x86"
libtbbVersion="12.1"
libtbbVersionCompat="$libtbbVersion compat >= ${libtbbVersion%%.*}"
libtbbbindVersion="3.1"
libtbbbindVersionCompat="$libtbbbindVersion compat >= ${libtbbbindVersion%%.*}"
libtbbmallocVersion="2.1"
libtbbmallocVersionCompat="$libtbbmallocVersion compat >= ${libtbbmallocVersion%%.*}"
libtbbmalloc_proxyVersion="2.1"
libtbbmalloc_proxyVersionCompat="$libtbbmalloc_proxyVersion compat >= ${libtbbmalloc_proxyVersion%%.*}"
PROVIDES="
tbb$secondaryArchSuffix = $portVersion
lib:libtbb$secondaryArchSuffix = $libtbbVersionCompat
lib:libtbbbind_2_0$secondaryArchSuffix = $libtbbbindVersionCompat
lib:libtbbmalloc$secondaryArchSuffix = $libtbbmallocVersionCompat
lib:libtbbmalloc_proxy$secondaryArchSuffix = $libtbbmalloc_proxyVersionCompat
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libhwloc$secondaryArchSuffix
"
PROVIDES_devel="
tbb${secondaryArchSuffix}_devel = $portVersion
devel:libtbb$secondaryArchSuffix = $libtbbVersionCompat
devel:libtbbbind_2_0$secondaryArchSuffix = $libtbbbindVersionCompat
devel:libtbbmalloc$secondaryArchSuffix = $libtbbmallocVersionCompat
devel:libtbbmalloc_proxy$secondaryArchSuffix = $libtbbmalloc_proxyVersionCompat
"
REQUIRES_devel="
tbb$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
hwloc2${secondaryArchSuffix}_tools >= 2.9
devel:libhwloc$secondaryArchSuffix >= 15.6.4
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:make
"
defineDebugInfoPackage tbb$secondaryArchSuffix \
$libDir/libtbb.so.$libtbbVersion \
$libDir/libtbbbind_2_0.so.$libtbbbindVersion \
$libDir/libtbbmalloc.so.$libtbbmallocVersion \
$libDir/libtbbmalloc_proxy.so.$libtbbmalloc_proxyVersion
BUILD()
{
mkdir -p build_haiku && cd build_haiku
cmake .. \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
$cmakeDirArgs \
-DTBB_STRICT=OFF \
-DTBB_TEST=ON
make $jobArgs
}
INSTALL()
{
cd build_haiku
make install
prepareInstalledDevelLibs libtbb \
libtbbbind_2_0 \
libtbbmalloc \
libtbbmalloc_proxy
# devel package
packageEntries devel \
$developDir \
$libDir/cmake
}
TEST()
{
# 98% tests passed, 2 tests failed out of 129
export LIBRARY_PATH="$sourceDir/build_haiku/gnu_13.3_cxx11_64_relwithdebinfo${LIBRARY_PATH:+:$LIBRARY_PATH}"
# Running the tests in parallel often leads to resource exhaustion. (Fedora)
ctest --test-dir build_haiku --output-on-failure --force-new-ctest-process
}