Skip to contentSkip to conversation

package/tbb: new package

PATCH New Fabrice Fontaine 2 participants 6 messages Dec 7, 2019 – Dec 8, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/3 package/tbb: new package

Intel Threading Building Blocks (TBB), is a C++ library to help developers write highly parallelized applications. OpenCV uses it to accelerate some of it's more heavy weight procedures.

---
Changes v2 -> v3 (after review of Thomas Petazzoni and Yegor Yefremov):
- Bump to latest version
- Add DEVELOPERS entry
- Drop unneeded patch
- Add needed dependencies to display comment in Config.in
- Drop BR2_ENABLE_DEBUG
- Fix install of headers
- Add hash for license file

 DEVELOPERS            |  1 +
 package/Config.in     |  1 +
 package/tbb/Config.in | 17 +++++++++++++++++
 package/tbb/tbb.hash  |  3 +++
 package/tbb/tbb.mk    | 39 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 61 insertions(+)
 create mode 100644 package/tbb/Config.in
 create mode 100644 package/tbb/tbb.hash
 create mode 100644 package/tbb/tbb.mk
DEVELOPERS +1 -0
index a1f94df951..177db44f25 100644
@@ -879,6 +879,7 @@ F:	package/python-parso/
 F:	package/rygel/
 F:	package/safeclib/
 F:	package/suricata/
+F:	package/tbb/
 F:	package/tinycbor/
 F:	package/tinydtls/
 F:	package/tinymembench/
package/Config.in +1 -0
index 9e2b78fe6a..5861078257 100644
@@ -1816,6 +1816,7 @@ endif
 	source "package/skalibs/Config.in"
 	source "package/sphinxbase/Config.in"
 	source "package/startup-notification/Config.in"
+	source "package/tbb/Config.in"
 	source "package/tinycbor/Config.in"
 	source "package/tz/Config.in"
 	source "package/tzdata/Config.in"
package/tbb/Config.in new file +17 -0
new file mode 100644
index 0000000000..8d4532795a
@@ -0,0 +1,17 @@
+config BR2_PACKAGE_TBB
+	bool "tbb"
+	depends on !BR2_STATIC_LIBS
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	help
+	  Intel(R) Threading Building Blocks (Intel(R) TBB) lets you
+	  easily write parallel C++ programs that take full advantage
+	  of multicore performance, that are portable, composable and
+	  have future-proof scalability.
+
+	  https://www.threadingbuildingblocks.org/
+
+comment "tbb needs a glibc toolchain w/ threads, C++, dynamic library"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS \
+		|| !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_USES_GLIBC
package/tbb/tbb.hash new file +3 -0
new file mode 100644
index 0000000000..c079d7a305
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  15652f5328cf00c576f065e5cd3eaf3317422fe82afb67a9bcec0dc065bd2abe  tbb-2019_U9.tar.gz
+sha256  c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4  LICENSE
package/tbb/tbb.mk new file +39 -0
new file mode 100644
index 0000000000..88ea4fec23
@@ -0,0 +1,39 @@
+################################################################################
+#
+# tbb
+#
+################################################################################
+
+TBB_VERSION = 2019_U9
+TBB_SITE = $(call github,intel,tbb,$(TBB_VERSION))
+TBB_INSTALL_STAGING = YES
+TBB_LICENSE = Apache-2.0
+TBB_LICENSE_FILES = LICENSE
+
+TBB_SO_VERSION = 2
+TBB_LIBS = libtbb libtbbmalloc libtbbmalloc_proxy
+
+TBB_BIN_PATH = $(@D)/build/linux_*_release
+
+define TBB_BUILD_CMDS
+	$(MAKE) $(TARGET_CONFIGURE_OPTS) arch=$(BR2_ARCH) -C $(@D)
+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
+	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))
Signature · 1 line
2.24.0
#1 lore raw

PATCH 2/3 package/sysdig: disable all bundled dependencies

Disable all dependencies through -DUSE_BUNDLED_DEPS=OFF instead of disabling them one by one

---
 package/sysdig/sysdig.mk | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
package/sysdig/sysdig.mk +1 -4
index 9ac990e3e2..c604032cf4 100644
@@ -8,10 +8,7 @@ SYSDIG_VERSION = 0.23.1
 SYSDIG_SITE = $(call github,draios,sysdig,$(SYSDIG_VERSION))
 SYSDIG_LICENSE = GPL-2.0
 SYSDIG_LICENSE_FILES = COPYING
-SYSDIG_CONF_OPTS = -DUSE_BUNDLED_LUAJIT=OFF -DUSE_BUNDLED_ZLIB=OFF \
-	-DUSE_BUNDLED_JSONCPP=OFF -DENABLE_DKMS=OFF -DUSE_BUNDLED_CURL=OFF \
-	-DUSE_BUNDLED_NCURSES=OFF -DUSE_BUNDLED_OPENSSL=OFF \
-	-DUSE_BUNDLED_JQ=OFF -DUSE_BUNDLED_B64=OFF
+SYSDIG_CONF_OPTS = -DENABLE_DKMS=OFF -DUSE_BUNDLED_DEPS=OFF
 SYSDIG_DEPENDENCIES = zlib luajit jsoncpp libcurl ncurses openssl jq libb64 elfutils
 SYSDIG_SUPPORTS_IN_SOURCE_BUILD = NO
 
Signature · 1 line
2.24.0
#2 lore raw

PATCH 2/3 package/sysdig: disable all bundled dependencies

Quoted 7 lines · On Sat, 7 Dec 2019 20:17:03 +0100 Fabrice Fontaine…

Disable all dependencies through -DUSE_BUNDLED_DEPS=OFF instead of disabling them one by one

---
 package/sysdig/sysdig.mk | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH 3/3 package/sysdig: bump to version 0.26.4

In reply to Fabrice Fontaine

- License is now Apache-2.0 except driver that is MIT and GPL-2.0:
https://github.com/draios/sysdig/commit/e404c50c346ce1a2750446aeaac59f4062f33b0a
- grpc is a mandatory dependency since version 0.25.0 and
https://github.com/draios/sysdig/commit/4362475c8a5c578c057d7ac16e453c6b2cf6c13e
- tbb is a mandatory dependency since version 0.24.0 and
https://github.com/draios/sysdig/commit/69ad6dd5144cfe30b2eac5a8ef56dffd178a11a3
- driver/driver_config.h is not prebuilt so generate it
- Fix build with kernel >= 5.1 thanks to
https://github.com/draios/sysdig/commit/a6ab1e66fc05a02178e051ea2441633996d5871e

Fixes:
- fix build with kernel >= 5.1

---
 package/sysdig/Config.in   | 18 +++++++++++++-----
 package/sysdig/sysdig.hash |  6 ++++--
 package/sysdig/sysdig.mk   | 13 +++++++++----
 3 files changed, 26 insertions(+), 11 deletions(-)
package/sysdig/Config.in +13 -5
index 672c44d211..2471a41537 100644
@@ -1,21 +1,26 @@
 config BR2_PACKAGE_SYSDIG
 	bool "sysdig"
 	depends on BR2_LINUX_KERNEL
-	depends on BR2_INSTALL_LIBSTDCPP # libjson
+	depends on BR2_INSTALL_LIBSTDCPP # libjson, grpc -> protobuf, tbb
 	depends on BR2_PACKAGE_LUAJIT_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_PROTOBUF_ARCH_SUPPORTS # grpc -> protobuf
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
-	depends on !BR2_STATIC_LIBS # luajit, elfutils
+	depends on !BR2_STATIC_LIBS # luajit, elfutils, grpc -> protobuf, tbb
 	depends on BR2_USE_WCHAR # elfutils
-	depends on BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC # elfutils
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 || BR2_TOOLCHAIN_HAS_ATOMIC # grpc
+	depends on BR2_TOOLCHAIN_HAS_THREADS # grpc -> protobuf, tbb
+	depends on BR2_TOOLCHAIN_USES_GLIBC # tbb
 	select BR2_PACKAGE_ZLIB
 	select BR2_PACKAGE_LUAJIT
 	select BR2_PACKAGE_JSONCPP
+	select BR2_PACKAGE_GRPC
 	select BR2_PACKAGE_LIBCURL
 	select BR2_PACKAGE_NCURSES
 	select BR2_PACKAGE_OPENSSL
 	select BR2_PACKAGE_JQ
 	select BR2_PACKAGE_LIBB64
 	select BR2_PACKAGE_ELFUTILS
+	select BR2_PACKAGE_TBB
 	help
 	  Sysdig is open source, system-level exploration:
 	  capture system state and activity from a running Linux
@@ -25,8 +30,11 @@ config BR2_PACKAGE_SYSDIG
 
 	  http://sysdig.org
 
-comment "sysdig needs a glibc or uclibc toolchain w/ C++, gcc >= 4.8, dynamic library and a Linux kernel to be built"
+comment "sysdig needs a glibc toolchain w/ C++, threads, gcc >= 4.8, dynamic library and a Linux kernel to be built"
 	depends on !BR2_LINUX_KERNEL || !BR2_INSTALL_LIBSTDCPP \
 		|| !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 || BR2_STATIC_LIBS \
-		|| !(BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC)
+		|| !BR2_TOOLCHAIN_USES_GLIBC \
+		|| !BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_PACKAGE_LUAJIT_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_PROTOBUF_ARCH_SUPPORTS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 || BR2_TOOLCHAIN_HAS_ATOMIC
package/sysdig/sysdig.hash +4 -2
index 565b1e9828..a5eab5a49a 100644
@@ -1,3 +1,5 @@
 # sha256 locally computed
-sha256  57d5b713b875eba35546a1408bf3f20c2703904a17d956be115ee55272db4cfa  sysdig-0.23.1.tar.gz
-sha256  8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  COPYING
+sha256  7c15ee25abf6cca850eaf6f4e42e25a1d9ad2b775ae794028f94afbd1ce9d271  sysdig-0.26.4.tar.gz
+sha256  a88fbf820b38b1c7fabc6efe291b8259e02ae21326f56fe31c6c9adf374b2702  COPYING
+sha256  8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  driver/GPL2.txt
+sha256  e3f6a43d097ed68176e9738de925d98b938e1bccf6d6bd1bcd79395eca8f76ed  driver/MIT.txt
package/sysdig/sysdig.mk +9 -4
index c604032cf4..9f90238346 100644
@@ -4,12 +4,13 @@
 #
 ################################################################################
 
-SYSDIG_VERSION = 0.23.1
+SYSDIG_VERSION = 0.26.4
 SYSDIG_SITE = $(call github,draios,sysdig,$(SYSDIG_VERSION))
-SYSDIG_LICENSE = GPL-2.0
-SYSDIG_LICENSE_FILES = COPYING
+SYSDIG_LICENSE = Apache-2.0 (userspace), GPL-2.0 (driver), MIT (driver)
+SYSDIG_LICENSE_FILES = COPYING driver/GPL2.txt driver/MIT.txt
 SYSDIG_CONF_OPTS = -DENABLE_DKMS=OFF -DUSE_BUNDLED_DEPS=OFF
-SYSDIG_DEPENDENCIES = zlib luajit jsoncpp libcurl ncurses openssl jq libb64 elfutils
+SYSDIG_DEPENDENCIES = \
+	zlib luajit jsoncpp libcurl ncurses openssl jq libb64 elfutils grpc tbb
 SYSDIG_SUPPORTS_IN_SOURCE_BUILD = NO
 
 # sysdig creates the module Makefile from a template, which contains a
@@ -22,6 +23,10 @@ define SYSDIG_MODULE_GEN_MAKEFILE
 	$(INSTALL) -m 0644 $(@D)/driver/Makefile.in $(@D)/driver/Makefile
 	$(SED) 's/@KBUILD_FLAGS@//;' $(@D)/driver/Makefile
 	$(SED) 's/@PROBE_NAME@/sysdig-probe/;' $(@D)/driver/Makefile
+	$(INSTALL) -m 0644 $(@D)/driver/driver_config.h.in $(@D)/driver/driver_config.h
+	$(SED) 's/$${PROBE_VERSION}/$(SYSDIG_VERSION)/;' $(@D)/driver/driver_config.h
+	$(SED) 's/$${PROBE_NAME}/sysdig-probe/;' $(@D)/driver/driver_config.h
+	$(SED) 's/$${PROBE_DEVICE_NAME}/sysdig/;' $(@D)/driver/driver_config.h
 endef
 SYSDIG_POST_PATCH_HOOKS += SYSDIG_MODULE_GEN_MAKEFILE
 
Signature · 1 line
2.24.0
#4 lore raw

PATCH 3/3 package/sysdig: bump to version 0.26.4

Hello,

Quoted 10 lines · On Sat, 7 Dec 2019 20:17:04 +0100 Fabrice Fontaine…

- License is now Apache-2.0 except driver that is MIT and GPL-2.0:
https://github.com/draios/sysdig/commit/e404c50c346ce1a2750446aeaac59f4062f33b0a
- grpc is a mandatory dependency since version 0.25.0 and
https://github.com/draios/sysdig/commit/4362475c8a5c578c057d7ac16e453c6b2cf6c13e
- tbb is a mandatory dependency since version 0.24.0 and
https://github.com/draios/sysdig/commit/69ad6dd5144cfe30b2eac5a8ef56dffd178a11a3
- driver/driver_config.h is not prebuilt so generate it
- Fix build with kernel >= 5.1 thanks to
https://github.com/draios/sysdig/commit/a6ab1e66fc05a02178e051ea2441633996d5871e

Quoted 4 lines

Fixes:
- fix build with kernel >= 5.1

A few minor comments. Since there are some issues/comments on the tbb patch itself, I guess you could fix up the comments on this patch at the same time.

package/sysdig/Config.in line 4

Quoted 10 lines
package/sysdig/Config.in +1 -1
index 672c44d211..2471a41537 100644
@@ -1,21 +1,26 @@
 config BR2_PACKAGE_SYSDIG
 	bool "sysdig"
 	depends on BR2_LINUX_KERNEL
-	depends on BR2_INSTALL_LIBSTDCPP # libjson
+	depends on BR2_INSTALL_LIBSTDCPP # libjson, grpc -> protobuf, tbb

No need for "grpc -> protobuf", just "grpc". If we start replicating the complete dependency chain in comments, it really becomes too much IMO.

Quoted 11 lines
package/sysdig/Config.in +5 -2
 	depends on BR2_PACKAGE_LUAJIT_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_PROTOBUF_ARCH_SUPPORTS # grpc -> protobuf
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
-	depends on !BR2_STATIC_LIBS # luajit, elfutils
+	depends on !BR2_STATIC_LIBS # luajit, elfutils, grpc -> protobuf, tbb
 	depends on BR2_USE_WCHAR # elfutils
-	depends on BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC # elfutils
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 || BR2_TOOLCHAIN_HAS_ATOMIC # grpc
+	depends on BR2_TOOLCHAIN_HAS_THREADS # grpc -> protobuf, tbb
+	depends on BR2_TOOLCHAIN_USES_GLIBC # tbb
 	select BR2_PACKAGE_ZLIB

package/sysdig/Config.in line 23

Quoted 10 lines
package/sysdig/Config.in +2 -0
 	select BR2_PACKAGE_LUAJIT
 	select BR2_PACKAGE_JSONCPP
+	select BR2_PACKAGE_GRPC
 	select BR2_PACKAGE_LIBCURL
 	select BR2_PACKAGE_NCURSES
 	select BR2_PACKAGE_OPENSSL
 	select BR2_PACKAGE_JQ
 	select BR2_PACKAGE_LIBB64
 	select BR2_PACKAGE_ELFUTILS
+	select BR2_PACKAGE_TBB

A preliminary commit re-ordering the list of selects to be sorted alphabetically would be nice.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#5 lore raw

PATCH v3 1/3 package/tbb: new package

In reply to Fabrice Fontaine
Quoted 5 lines · On Sat, 7 Dec 2019 20:17:02 +0100 Fabrice Fontaine…

Intel Threading Building Blocks (TBB), is a C++ library to help developers write highly parallelized applications. OpenCV uses it to accelerate some of it's more heavy weight procedures.

The commit author must match the first Signed-off-by. Since either Bradford must be kept as the author, or you need to be the first Signed-off-by (and you can credit Bradford with something like "Based on initial work from ..." in the commit log).

package/tbb/Config.in line 6

Quoted 12 lines
package/tbb/Config.in new file +6 -0
new file mode 100644
index 0000000000..8d4532795a
@@ -0,0 +1,17 @@
+config BR2_PACKAGE_TBB
+	bool "tbb"
+	depends on !BR2_STATIC_LIBS
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_TOOLCHAIN_USES_GLIBC

Would be good to have a small comment that says why this depends on glibc.

OpenEmbedded had a patch that I guess made it work with non-glibc toolchains:
https://github.com/openembedded/meta-openembedded/blob/master/meta-oe/recipes-support/tbb/tbb/0001-mallinfo-is-glibc-specific-API-mark-it-so.patch

package/tbb/Config.in

Quoted 13 lines
package/tbb/Config.in new file +13 -0
+TBB_VERSION = 2019_U9
+TBB_SITE = $(call github,intel,tbb,$(TBB_VERSION))
+TBB_INSTALL_STAGING = YES
+TBB_LICENSE = Apache-2.0
+TBB_LICENSE_FILES = LICENSE
+
+TBB_SO_VERSION = 2
+TBB_LIBS = libtbb libtbbmalloc libtbbmalloc_proxy
+
+TBB_BIN_PATH = $(@D)/build/linux_*_release
+
+define TBB_BUILD_CMDS
+	$(MAKE) $(TARGET_CONFIGURE_OPTS) arch=$(BR2_ARCH) -C $(@D)

I am a bit skeptical about arch=$(BR2_ARCH). Indeed, when I look at
https://github.com/intel/tbb/blob/tbb_2019/build/linux.gcc.inc and see the values for $(arch) that are used, it's ia32, intel64, ia64, which we don't use in Buildroot. Are you sure we can simply pass $(BR2_ARCH) as "arch" ? Doesn't this require a conversion between the BR2_ARCH values in Buildroot, and the "arch" values expected by TBB Makefiles ?

package/tbb/Config.in

Quoted 11 lines
package/tbb/Config.in new file +11 -0
+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

Need to create the $(STAGING_DIR)/usr/include folder before copying files into it.

package/tbb/Config.in

Quoted 9 lines
package/tbb/Config.in new file +9 -0
+	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))

Best regards,

Thomas Petazzoni

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com