All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] package/tbb: bump to version 2021.5.0
@ 2022-04-16 21:07 Fabrice Fontaine
  2022-04-16 21:07 ` [Buildroot] [PATCH 2/2] package/opencv4: add tbb support Fabrice Fontaine
  2022-04-19 16:32 ` [Buildroot] [PATCH 1/2] package/tbb: bump to version 2021.5.0 Francis Laniel
  0 siblings, 2 replies; 5+ messages in thread
From: Fabrice Fontaine @ 2022-04-16 21:07 UTC (permalink / raw)
  To: buildroot
  Cc: Francis Laniel, Angelo Compagnucci, Samuel Martin, Fabrice Fontaine

- Switch to cmake-package
- Drop DO_ITT_NOTIFY which is only used in example and test
- license file has been renamed to LICENSE.txt
- Add upstream patches to fix musl build

https://www.intel.com/content/www/us/en/developer/articles/release-notes/intel-oneapi-threading-building-blocks-release-notes.html

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 package/sysdig/Config.in                      |  2 +-
 ...Musl-linux-can-not-use-RTLD_DEEPBIND.patch | 33 ++++++++++++
 ...is-only-defined-on-glibc-and-android.patch | 42 ++++++++++++++++
 package/tbb/Config.in                         | 12 +++--
 package/tbb/tbb.hash                          |  4 +-
 package/tbb/tbb.mk                            | 50 +++----------------
 6 files changed, 94 insertions(+), 49 deletions(-)
 create mode 100644 package/tbb/0001-Musl-linux-can-not-use-RTLD_DEEPBIND.patch
 create mode 100644 package/tbb/0002-mallinfo-is-only-defined-on-glibc-and-android.patch

diff --git a/package/sysdig/Config.in b/package/sysdig/Config.in
index 3a4c033b2b..c124054105 100644
--- a/package/sysdig/Config.in
+++ b/package/sysdig/Config.in
@@ -7,7 +7,7 @@ config BR2_PACKAGE_SYSDIG
 	depends on BR2_TOOLCHAIN_HAS_THREADS # elfutils, jq, protobuf, tbb
 	depends on !BR2_STATIC_LIBS # elfutils, protobuf, tbb
 	depends on BR2_USE_WCHAR # elfutils
-	depends on BR2_TOOLCHAIN_USES_GLIBC # elfutils, tbb
+	depends on BR2_TOOLCHAIN_USES_GLIBC # elfutils
 	depends on BR2_PACKAGE_LUAINTERPRETER_ABI_VERSION_5_1
 	select BR2_PACKAGE_C_ARES
 	select BR2_PACKAGE_ELFUTILS
diff --git a/package/tbb/0001-Musl-linux-can-not-use-RTLD_DEEPBIND.patch b/package/tbb/0001-Musl-linux-can-not-use-RTLD_DEEPBIND.patch
new file mode 100644
index 0000000000..82182ce109
--- /dev/null
+++ b/package/tbb/0001-Musl-linux-can-not-use-RTLD_DEEPBIND.patch
@@ -0,0 +1,33 @@
+From 883c2e5245c39624b3b5d6d56d5b203cf09eac38 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 15 Dec 2021 08:08:07 -0800
+Subject: [PATCH] Musl/linux can not use RTLD_DEEPBIND (#684)
+
+Exclude non-glibc linux systems along with android
+Fixes
+src/tbb/dynamic_link.cpp:417:29: error: use
+ of undeclared identifier 'RTLD_DEEPBIND'                                                                                    |             flags = flags | RTLD_DEEPBIND;
+|                             ^
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+[Retrieved from:
+https://github.com/oneapi-src/oneTBB/commit/883c2e5245c39624b3b5d6d56d5b203cf09eac38]
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ src/tbb/dynamic_link.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/tbb/dynamic_link.cpp b/src/tbb/dynamic_link.cpp
+index 3f1342503..5330d7107 100644
+--- a/src/tbb/dynamic_link.cpp
++++ b/src/tbb/dynamic_link.cpp
+@@ -413,7 +413,7 @@ namespace r1 {
+         int flags = RTLD_NOW;
+         if (local_binding) {
+             flags = flags | RTLD_LOCAL;
+-#if __linux__ && !__ANDROID__ && !__TBB_USE_SANITIZERS
++#if (__linux__ && __GLIBC__) && !__TBB_USE_SANITIZERS
+             flags = flags | RTLD_DEEPBIND;
+ #endif
+         } else {
diff --git a/package/tbb/0002-mallinfo-is-only-defined-on-glibc-and-android.patch b/package/tbb/0002-mallinfo-is-only-defined-on-glibc-and-android.patch
new file mode 100644
index 0000000000..9b397cac41
--- /dev/null
+++ b/package/tbb/0002-mallinfo-is-only-defined-on-glibc-and-android.patch
@@ -0,0 +1,42 @@
+From 3a7f96db56cc9821055cbc769d3065db86b8b4c9 Mon Sep 17 00:00:00 2001
+From: Julien Voisin <jvoisin@users.noreply.github.com>
+Date: Mon, 7 Feb 2022 07:56:15 +0100
+Subject: [PATCH] mallinfo is only defined on glibc and android (#764)
+
+It currently prevents compilation under musl:
+
+```
+[ 90%] Building CXX object src/tbbmalloc_proxy/CMakeFiles/tbbmalloc_proxy.dir/proxy.cpp.o
+/__w/mimalloc-bench/mimalloc-bench/extern/tbb/src/tbbmalloc_proxy/proxy.cpp:263:26: error: return type 'struct mallinfo' is incomplete
+  263 | struct mallinfo mallinfo() __THROW
+      |                          ^
+compilation terminated due to -Wfatal-errors.
+``
+
+[Retrieved from:
+https://github.com/oneapi-src/oneTBB/commit/3a7f96db56cc9821055cbc769d3065db86b8b4c9]
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ src/tbbmalloc_proxy/proxy.cpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/tbbmalloc_proxy/proxy.cpp b/src/tbbmalloc_proxy/proxy.cpp
+index e58e55e0b..23b9c19c1 100644
+--- a/src/tbbmalloc_proxy/proxy.cpp
++++ b/src/tbbmalloc_proxy/proxy.cpp
+@@ -260,6 +260,7 @@ int mallopt(int /*param*/, int /*value*/) __THROW
+     return 1;
+ }
+ 
++#if defined(__GLIBC__) || defined(__ANDROID__)
+ struct mallinfo mallinfo() __THROW
+ {
+     struct mallinfo m;
+@@ -267,6 +268,7 @@ struct mallinfo mallinfo() __THROW
+ 
+     return m;
+ }
++#endif
+ 
+ #if __ANDROID__
+ // Android doesn't have malloc_usable_size, provide it to be compatible
diff --git a/package/tbb/Config.in b/package/tbb/Config.in
index 0f40b74d31..b2e97829b5 100644
--- a/package/tbb/Config.in
+++ b/package/tbb/Config.in
@@ -1,9 +1,11 @@
 config BR2_PACKAGE_TBB
 	bool "tbb"
-	depends on BR2_TOOLCHAIN_USES_GLIBC
+	# tbb needs fenv.h which is not provided by uclibc
+	depends on !BR2_TOOLCHAIN_USES_UCLIBC
 	depends on !BR2_STATIC_LIBS
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_INSTALL_LIBSTDCPP
+	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # exception_ptr
 	help
 	  Intel(R) Threading Building Blocks (Intel(R) TBB) lets you
 	  easily write parallel C++ programs that take full advantage
@@ -12,5 +14,9 @@ config BR2_PACKAGE_TBB
 
 	  https://www.threadingbuildingblocks.org/
 
-comment "tbb needs a glibc toolchain w/ dynamic library, threads, C++"
-	depends on !BR2_TOOLCHAIN_USES_GLIBC || BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
+comment "tbb needs a glibc or musl toolchain w/ dynamic library, threads, C++"
+	depends on BR2_TOOLCHAIN_USES_UCLIBC || BR2_STATIC_LIBS || \
+		!BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
+
+comment "tbb needs exception_ptr"
+	depends on BR2_TOOLCHAIN_HAS_GCC_BUG_64735
diff --git a/package/tbb/tbb.hash b/package/tbb/tbb.hash
index 81d224b3ca..9992fb3c4f 100644
--- a/package/tbb/tbb.hash
+++ b/package/tbb/tbb.hash
@@ -1,3 +1,3 @@
 # Locally calculated
-sha256  b8dbab5aea2b70cf07844f86fa413e549e099aa3205b6a04059ca92ead93a372  tbb-2018_U5.tar.gz
-sha256  c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4  LICENSE
+sha256  e5b57537c741400cf6134b428fc1689a649d7d38d9bb9c1b6d64f092ea28178a  tbb-2021.5.0.tar.gz
+sha256  c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4  LICENSE.txt
diff --git a/package/tbb/tbb.mk b/package/tbb/tbb.mk
index 87e83551fe..afe756a85a 100644
--- a/package/tbb/tbb.mk
+++ b/package/tbb/tbb.mk
@@ -4,52 +4,16 @@
 #
 ################################################################################
 
-TBB_VERSION = 2018_U5
-TBB_SITE = $(call github,01org,tbb,$(TBB_VERSION))
+TBB_VERSION = 2021.5.0
+TBB_SITE = $(call github,01org,tbb,v$(TBB_VERSION))
 TBB_INSTALL_STAGING = YES
 TBB_LICENSE = Apache-2.0
-TBB_LICENSE_FILES = LICENSE
+TBB_LICENSE_FILES = LICENSE.txt
 TBB_CPE_ID_VENDOR = intel
 TBB_CPE_ID_PRODUCT = threading_building_blocks
 
-TBB_SO_VERSION = 2
-TBB_LIBS = libtbb libtbbmalloc libtbbmalloc_proxy
-TBB_BIN_PATH = $(@D)/build/linux_*
+TBB_CONF_OPTS = \
+	-DTBB_STRICT=OFF \
+	-DTBB_TEST=OFF
 
-# arch is normally set based on uname -m with some conversions. However,
-# it is not really used for much:
-# - to decide between 32 or 64-bit files (based on '64' in the name)
-# - to decide on some arch-specific CFLAGS like -m32, which we don't actually want
-# - to set DO_ITT_NOTIFY if it's x86 (32 or 64 bit)
-# - to include assembler source, but it only exists for ia64
-# The only thing we actually want from the above is the 32/64-bit, and
-# DO_ITT_NOTIFY. Therefore, set arch to a fixed value which is unknown to
-# the tbb build system, and set DO_ITT_NOTIFY explicitly.
-TBB_ARCH = $(if $(BR2_ARCH_IS_64),buildroot64,buildroot32)
-TBB_ITT_NOTIFY = $(if $(BR2_i386)$(BR2_x86_64),-DDO_ITT_NOTIFY)
-TBB_CXXFLAGS = $(TARGET_CXXFLAGS) $(TBB_ITT_NOTIFY)
-
-define TBB_BUILD_CMDS
-	$(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) arch=$(TBB_ARCH) \
-		CPLUS="$(TARGET_CXX)" CONLY="$(TARGET_CC)" CXXFLAGS="$(TBB_CXXFLAGS)"
-endef
-
-define TBB_INSTALL_LIBS
-	$(foreach lib,$(TBB_LIBS),
-		$(INSTALL) -D -m 0755 $(TBB_BIN_PATH)/$(lib).so.$(TBB_SO_VERSION) \
-			$(1)/usr/lib/$(lib).so.$(TBB_SO_VERSION) ;
-		ln -sf $(lib).so.$(TBB_SO_VERSION) $(1)/usr/lib/$(lib).so
-	)
-endef
-
-define TBB_INSTALL_STAGING_CMDS
-	mkdir -p $(STAGING_DIR)/usr/include/
-	cp -a $(@D)/include/* $(STAGING_DIR)/usr/include/
-	$(call TBB_INSTALL_LIBS,$(STAGING_DIR))
-endef
-
-define TBB_INSTALL_TARGET_CMDS
-	$(call TBB_INSTALL_LIBS,$(TARGET_DIR))
-endef
-
-$(eval $(generic-package))
+$(eval $(cmake-package))
-- 
2.35.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-04-21 20:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-16 21:07 [Buildroot] [PATCH 1/2] package/tbb: bump to version 2021.5.0 Fabrice Fontaine
2022-04-16 21:07 ` [Buildroot] [PATCH 2/2] package/opencv4: add tbb support Fabrice Fontaine
2022-04-21 20:53   ` Arnout Vandecappelle
2022-04-19 16:32 ` [Buildroot] [PATCH 1/2] package/tbb: bump to version 2021.5.0 Francis Laniel
2022-04-19 20:48   ` Arnout Vandecappelle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.