All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [RFC PATCH v1 0/2] Fix sysdig build errors
@ 2022-04-07 18:24 Francis Laniel
  2022-04-07 18:24 ` [Buildroot] [RFC PATCH v1 1/2] tbb: new package Francis Laniel
  2022-04-07 18:24 ` [Buildroot] [RFC PATCH v1 2/2] package/sysdig: bump version to 0.27.1 Francis Laniel
  0 siblings, 2 replies; 7+ messages in thread
From: Francis Laniel @ 2022-04-07 18:24 UTC (permalink / raw)
  To: buildroot
  Cc: Francis Laniel, Angelo Compagnucci, bradford barr, Thomas Petazzoni

Hi.


First of all, I hope you are fine and the same for your relatives.

When building a system with recent kernel with BR2_PACKAGE_SYSDIG, I got some
compilation errors when building sysdig libsinsp:
.../sysdig-0.23.1/userspace/libsinsp/chisel.cpp:99:30: error: elements of array ‘const luaL_reg ll_sysdig []’ have incomplete type
   99 | const static struct luaL_reg ll_sysdig [] =
After that, an error when building modules occurs:
.../sysdig-0.23.1/driver/ppm.h:62:18: error: field ‘last_print_time’ has incomplete type
   62 |  struct timespec last_print_time;
And finally an error during link time occurs:
.../sysdig-0.23.1/userspace/libsinsp.a(cri.grpc.pb.cc.o): undefined reference to symbol '_ZN4absl12lts_202103245MutexD1Ev'

Concerning the error in libsinsp, a patch was added to sysdig recipe.
This patch is based on Minikube patch, which is in turn based on sysdig
CMakeLists.txt PATCH_COMMAND [1, 2].
The modules errors were fixed upstream, so I bumped sysdig version to 0.27.1
[3, 4].
For the linking one, a patch already exist to fix this buggy behavior [5].

Sysdig 0.27.1 relies on tbb, so a recipe for this library was added.
Note that, this recipe was originally written by Bradford Barr and I just bumped
its version to suit sysdig case [6].

With the two patches applied, I was able to build and boot an image within qemu:
$ make qemu_x86_64_defconfig
$ make menuconfig
# Set glibc as library, enable c++, enable luajit and enable sysdig.
$ make linux-menuconfig
# Enable FTRACE
$ make -j$(nproc)
...
$ bash start-qemu.sh
...
Welcome to Buildroot
buildroot login: root
# insmod /lib/modules/5.15.18/extra/sysdig-probe.ko
sysdig_probe: loading out-of-tree module taints kernel.
sysdig_probe: driver loading, sysdig-probe 0.1.1dev
# sysdig --version
sysdig version 0.1.1dev

If you see any way to improve this contribution, feel free to share it!

Francis Laniel (1):
  package/sysdig: bump version to 0.27.1.

bradford barr (1):
  tbb: new package

 DEVELOPERS                                    |  1 +
 package/Config.in                             |  1 +
 ...ATCH_COMMAND-to-fix-lua-types-and-fu.patch | 82 +++++++++++++++++++
 ...gainst-libabseil-cpp-which-grpc-uses.patch | 45 ++++++++++
 package/sysdig/Config.in                      |  5 ++
 package/sysdig/sysdig.hash                    |  1 +
 package/sysdig/sysdig.mk                      |  7 +-
 .../0001-tbb-Enable-cross-compilation.patch   | 55 +++++++++++++
 package/tbb/Config.in                         | 16 ++++
 package/tbb/tbb.hash                          |  2 +
 package/tbb/tbb.mk                            | 39 +++++++++
 11 files changed, 253 insertions(+), 1 deletion(-)
 create mode 100644 package/sysdig/0001-libsinsp-Apply-PATCH_COMMAND-to-fix-lua-types-and-fu.patch
 create mode 100644 package/sysdig/0002-Link-against-libabseil-cpp-which-grpc-uses.patch
 create mode 100644 package/tbb/0001-tbb-Enable-cross-compilation.patch
 create mode 100644 package/tbb/Config.in
 create mode 100644 package/tbb/tbb.hash
 create mode 100644 package/tbb/tbb.mk


Best regards and thank you in advance for your reviews.

P.S.: If you are interested, this bug was spotted while trying to bump Minikube
kernel to 5.10.57 [7].

---
[1] https://github.com/kubernetes/minikube/commit/f036c279bc598cf59affb0fc538c017d83afb7ab
[2] https://github.com/draios/sysdig/commit/a064440394c93a7579dc6e1db13c8378d5eecd6f
[3] https://github.com/draios/sysdig/commit/938986890291c126f9b8f3a050bc3edc95fb6f5a
[4] https://github.com/draios/sysdig/commit/2691cbc66c7faa973333d65a69909be06be21c18
[5] https://github.com/hhoffstaette/portage/blob/8d047247719a15c5a63001f65ba348514706277d/dev-util/sysdig/files/0.27.1-grpc-absl-sync.patch
[6] https://patchwork.ozlabs.org/project/buildroot/patch/20170928235043.31891-2-bradford@density.io/
[7] https://github.com/kubernetes/minikube/pull/12707
-- 
2.25.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [RFC PATCH v1 1/2] tbb: new package
  2022-04-07 18:24 [Buildroot] [RFC PATCH v1 0/2] Fix sysdig build errors Francis Laniel
@ 2022-04-07 18:24 ` Francis Laniel
  2022-04-09 13:42   ` Arnout Vandecappelle
  2022-04-07 18:24 ` [Buildroot] [RFC PATCH v1 2/2] package/sysdig: bump version to 0.27.1 Francis Laniel
  1 sibling, 1 reply; 7+ messages in thread
From: Francis Laniel @ 2022-04-07 18:24 UTC (permalink / raw)
  To: buildroot
  Cc: Francis Laniel, Angelo Compagnucci, bradford barr, Thomas Petazzoni

From: bradford barr <bradford@density.io>

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.

Signed-off-by: bradford barr <bradford@density.io>
Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
---
 DEVELOPERS                                    |  1 +
 package/Config.in                             |  1 +
 .../0001-tbb-Enable-cross-compilation.patch   | 55 +++++++++++++++++++
 package/tbb/Config.in                         | 16 ++++++
 package/tbb/tbb.hash                          |  2 +
 package/tbb/tbb.mk                            | 39 +++++++++++++
 6 files changed, 114 insertions(+)
 create mode 100644 package/tbb/0001-tbb-Enable-cross-compilation.patch
 create mode 100644 package/tbb/Config.in
 create mode 100644 package/tbb/tbb.hash
 create mode 100644 package/tbb/tbb.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index a66b9d7eee..ef4ddcab50 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -970,6 +970,7 @@ F:	package/odhcploc/
 
 N:	Francis Laniel <flaniel@linux.microsoft.com>
 F:	package/pahole/
+F:	package/tbb/
 
 N:	Francisco Gonzalez <gzmorell@gmail.com>
 F:	package/ser2net/
diff --git a/package/Config.in b/package/Config.in
index 0d5d763180..24f7af5ea8 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2044,6 +2044,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"
diff --git a/package/tbb/0001-tbb-Enable-cross-compilation.patch b/package/tbb/0001-tbb-Enable-cross-compilation.patch
new file mode 100644
index 0000000000..652d59c47b
--- /dev/null
+++ b/package/tbb/0001-tbb-Enable-cross-compilation.patch
@@ -0,0 +1,55 @@
+From 42c3faff14917f687aab405d8f571e352ffdf3f5 Mon Sep 17 00:00:00 2001
+From: Francis Laniel <flaniel@linux.microsoft.com>
+Date: Wed, 6 Apr 2022 15:58:02 +0100
+Subject: [PATCH] tbb: Enable cross-compilation.
+
+This patch replaces hardcoded value for CPLUS and CONLY with $(CXX) and $(CC).
+So, by defining CC= it is possible to cross compile this library using a
+cross-compiler.
+
+This patch was originally written by:
+Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
+and taken from:
+https://github.com/intel/luv-yocto/blob/3b0688bc9a5e8d52b6ca461b15fb4abd3eaaf7a8/meta-oe/recipes-support/tbb/tbb/cross-compile.patch
+
+Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
+---
+ build/linux.clang.inc | 5 +++--
+ build/linux.gcc.inc   | 5 +++--
+ 2 files changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/build/linux.clang.inc b/build/linux.clang.inc
+index 5a459ef5..a0777db5 100644
+--- a/build/linux.clang.inc
++++ b/build/linux.clang.inc
+@@ -31,8 +31,9 @@ DYLIB_KEY = -shared
+ EXPORT_KEY = -Wl,--version-script,
+ LIBDL = -ldl
+ 
+-CPLUS = clang++
+-CONLY = clang
++CPLUS = $(CXX)
++CONLY = $(CC)
++CPLUS_FLAGS = $(CXXFLAGS)
+ LIB_LINK_FLAGS = $(DYLIB_KEY) -Wl,-soname=$(BUILDING_LIBRARY)
+ LIBS += -lpthread -lrt
+ LINK_FLAGS = -Wl,-rpath-link=. -rdynamic
+diff --git a/build/linux.gcc.inc b/build/linux.gcc.inc
+index 786c4153..30242a82 100644
+--- a/build/linux.gcc.inc
++++ b/build/linux.gcc.inc
+@@ -32,8 +32,9 @@ DYLIB_KEY = -shared
+ EXPORT_KEY = -Wl,--version-script,
+ LIBDL = -ldl
+ 
+-CPLUS = g++
+-CONLY = gcc
++CPLUS = $(CXX)
++CONLY = $(CC)
++CPLUS_FLAGS = $(CXXFLAGS)
+ LIB_LINK_FLAGS = $(DYLIB_KEY) -Wl,-soname=$(BUILDING_LIBRARY)
+ LIBS += -lpthread -lrt
+ LINK_FLAGS = -Wl,-rpath-link=. -rdynamic
+-- 
+2.25.1
+
diff --git a/package/tbb/Config.in b/package/tbb/Config.in
new file mode 100644
index 0000000000..0f40b74d31
--- /dev/null
+++ b/package/tbb/Config.in
@@ -0,0 +1,16 @@
+config BR2_PACKAGE_TBB
+	bool "tbb"
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	depends on !BR2_STATIC_LIBS
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_INSTALL_LIBSTDCPP
+	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/ dynamic library, threads, C++"
+	depends on !BR2_TOOLCHAIN_USES_GLIBC || BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
diff --git a/package/tbb/tbb.hash b/package/tbb/tbb.hash
new file mode 100644
index 0000000000..e9fb7511b8
--- /dev/null
+++ b/package/tbb/tbb.hash
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256  b8dbab5aea2b70cf07844f86fa413e549e099aa3205b6a04059ca92ead93a372  tbb-2018_U5.tar.gz
diff --git a/package/tbb/tbb.mk b/package/tbb/tbb.mk
new file mode 100644
index 0000000000..cf06579b98
--- /dev/null
+++ b/package/tbb/tbb.mk
@@ -0,0 +1,39 @@
+################################################################################
+#
+# tbb
+#
+################################################################################
+
+TBB_VERSION = 2018_U5
+TBB_SITE = $(call github,01org,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_*
+
+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
+	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))
-- 
2.25.1

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

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

* [Buildroot] [RFC PATCH v1 2/2] package/sysdig: bump version to 0.27.1.
  2022-04-07 18:24 [Buildroot] [RFC PATCH v1 0/2] Fix sysdig build errors Francis Laniel
  2022-04-07 18:24 ` [Buildroot] [RFC PATCH v1 1/2] tbb: new package Francis Laniel
@ 2022-04-07 18:24 ` Francis Laniel
  2022-04-09 14:40   ` Arnout Vandecappelle
  1 sibling, 1 reply; 7+ messages in thread
From: Francis Laniel @ 2022-04-07 18:24 UTC (permalink / raw)
  To: buildroot
  Cc: Francis Laniel, Angelo Compagnucci, bradford barr, Thomas Petazzoni

0.23.1 has compilation errors with recent kernels.

Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
---
 ...ATCH_COMMAND-to-fix-lua-types-and-fu.patch | 82 +++++++++++++++++++
 ...gainst-libabseil-cpp-which-grpc-uses.patch | 45 ++++++++++
 package/sysdig/Config.in                      |  5 ++
 package/sysdig/sysdig.hash                    |  1 +
 package/sysdig/sysdig.mk                      |  7 +-
 5 files changed, 139 insertions(+), 1 deletion(-)
 create mode 100644 package/sysdig/0001-libsinsp-Apply-PATCH_COMMAND-to-fix-lua-types-and-fu.patch
 create mode 100644 package/sysdig/0002-Link-against-libabseil-cpp-which-grpc-uses.patch

diff --git a/package/sysdig/0001-libsinsp-Apply-PATCH_COMMAND-to-fix-lua-types-and-fu.patch b/package/sysdig/0001-libsinsp-Apply-PATCH_COMMAND-to-fix-lua-types-and-fu.patch
new file mode 100644
index 0000000000..7873210281
--- /dev/null
+++ b/package/sysdig/0001-libsinsp-Apply-PATCH_COMMAND-to-fix-lua-types-and-fu.patch
@@ -0,0 +1,82 @@
+From cc8bccc3ebb90103900a7f0f2b085ddb723b8792 Mon Sep 17 00:00:00 2001
+From: Francis Laniel <flaniel@linux.microsoft.com>
+Date: Wed, 6 Apr 2022 16:54:37 +0100
+Subject: [PATCH] libsinsp: Apply PATCH_COMMAND to fix lua types and function.
+
+Buildroot luajit 5.1 seems to not have compatibility between luaL_reg and
+luaL_Reg.
+So, we apply sysdig CMakeLists.txt PATCH_COMMAND to fix this and lua function
+call as well.
+Note that, this PATCH_COMMAND was added in sysdig in:
+a064440394c9 ("Adding power support to Travis builds (#1566)")
+
+This patch is also present in kubernetes/minikube in:
+f036c279bc59 ("Add patch for compiling sysdig with system luajit")
+
+Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
+---
+ userspace/libsinsp/chisel.cpp         | 6 +++---
+ userspace/libsinsp/lua_parser.cpp     | 2 +-
+ userspace/libsinsp/lua_parser_api.cpp | 2 +-
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/userspace/libsinsp/chisel.cpp b/userspace/libsinsp/chisel.cpp
+index 0a6e3cf8..0c2e255a 100644
+--- a/userspace/libsinsp/chisel.cpp
++++ b/userspace/libsinsp/chisel.cpp
+@@ -98,7 +98,7 @@ void lua_stackdump(lua_State *L)
+ // Lua callbacks
+ ///////////////////////////////////////////////////////////////////////////////
+ #ifdef HAS_LUA_CHISELS
+-const static struct luaL_reg ll_sysdig [] =
++const static struct luaL_Reg ll_sysdig [] =
+ {
+ 	{"set_filter", &lua_cbacks::set_global_filter},
+ 	{"set_snaplen", &lua_cbacks::set_snaplen},
+@@ -134,7 +134,7 @@ const static struct luaL_reg ll_sysdig [] =
+ 	{NULL,NULL}
+ };
+ 
+-const static struct luaL_reg ll_chisel [] =
++const static struct luaL_Reg ll_chisel [] =
+ {
+ 	{"request_field", &lua_cbacks::request_field},
+ 	{"set_filter", &lua_cbacks::set_filter},
+@@ -146,7 +146,7 @@ const static struct luaL_reg ll_chisel [] =
+ 	{NULL,NULL}
+ };
+ 
+-const static struct luaL_reg ll_evt [] =
++const static struct luaL_Reg ll_evt [] =
+ {
+ 	{"field", &lua_cbacks::field},
+ 	{"get_num", &lua_cbacks::get_num},
+diff --git a/userspace/libsinsp/lua_parser.cpp b/userspace/libsinsp/lua_parser.cpp
+index 0e26617d..78810d96 100644
+--- a/userspace/libsinsp/lua_parser.cpp
++++ b/userspace/libsinsp/lua_parser.cpp
+@@ -32,7 +32,7 @@ extern "C" {
+ #include "lauxlib.h"
+ }
+ 
+-const static struct luaL_reg ll_filter [] =
++const static struct luaL_Reg ll_filter [] =
+ {
+ 	{"rel_expr", &lua_parser_cbacks::rel_expr},
+ 	{"bool_op", &lua_parser_cbacks::bool_op},
+diff --git a/userspace/libsinsp/lua_parser_api.cpp b/userspace/libsinsp/lua_parser_api.cpp
+index c89e9126..c3d8008a 100644
+--- a/userspace/libsinsp/lua_parser_api.cpp
++++ b/userspace/libsinsp/lua_parser_api.cpp
+@@ -266,7 +266,7 @@ int lua_parser_cbacks::rel_expr(lua_State *ls)
+ 					string err = "Got non-table as in-expression operand\n";
+ 					throw sinsp_exception("parser API error");
+ 				}
+-				int n = luaL_getn(ls, 4);  /* get size of table */
++				int n = lua_objlen (ls, 4);  /* get size of table */
+ 				for (i=1; i<=n; i++)
+ 				{
+ 					lua_rawgeti(ls, 4, i);
+-- 
+2.25.1
+
diff --git a/package/sysdig/0002-Link-against-libabseil-cpp-which-grpc-uses.patch b/package/sysdig/0002-Link-against-libabseil-cpp-which-grpc-uses.patch
new file mode 100644
index 0000000000..60c3d31a3e
--- /dev/null
+++ b/package/sysdig/0002-Link-against-libabseil-cpp-which-grpc-uses.patch
@@ -0,0 +1,45 @@
+From a7fb3b863c3574470c45fdf6084dcc40931ca017 Mon Sep 17 00:00:00 2001
+From: Francis Laniel <flaniel@linux.microsoft.com>
+Date: Thu, 7 Apr 2022 18:30:23 +0100
+Subject: [PATCH 2/2] Link against libabseil-cpp which grpc uses.
+
+This patch was taken from:
+55c96b61f7b9 ("sysdig: make extra linking against abseil conditional")
+from hhoffstaette/portage.
+
+Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
+---
+ CMakeLists.txt                    | 1 +
+ userspace/libsinsp/CMakeLists.txt | 4 ++++
+ 2 files changed, 5 insertions(+)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 1f34f1d6..c0354b29 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -552,6 +552,7 @@ if(NOT WIN32 AND NOT APPLE)
+ 			else()
+ 				message(FATAL_ERROR "Couldn't find system grpc")
+ 			endif()
++			find_library(ABSL_SYNC_LIB NAMES absl_synchronization)
+ 			find_program(GRPC_CPP_PLUGIN grpc_cpp_plugin)
+ 			if(NOT GRPC_CPP_PLUGIN)
+ 				message(FATAL_ERROR "System grpc_cpp_plugin not found")
+diff --git a/userspace/libsinsp/CMakeLists.txt b/userspace/libsinsp/CMakeLists.txt
+index d72f9115..d1b7ea02 100644
+--- a/userspace/libsinsp/CMakeLists.txt
++++ b/userspace/libsinsp/CMakeLists.txt
+@@ -214,6 +214,10 @@ if(NOT WIN32)
+ 				"${JQ_LIB}"
+ 				"${B64_LIB}")
+ 
++			if(ABSL_SYNC_LIB)
++				target_link_libraries(sinsp "${ABSL_SYNC_LIB}")
++			endif()
++
+ 			if(NOT MUSL_OPTIMIZED_BUILD)
+ 			target_link_libraries(sinsp
+ 				rt
+-- 
+2.25.1
+
diff --git a/package/sysdig/Config.in b/package/sysdig/Config.in
index 06d20c7f7b..5a7fbb50e0 100644
--- a/package/sysdig/Config.in
+++ b/package/sysdig/Config.in
@@ -8,13 +8,18 @@ config BR2_PACKAGE_SYSDIG
 	depends on BR2_USE_WCHAR # elfutils
 	depends on BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC # elfutils
 	depends on BR2_PACKAGE_LUAINTERPRETER_ABI_VERSION_5_1
+	select BR2_PACKAGE_C_ARES
 	select BR2_PACKAGE_ELFUTILS
+	select BR2_PACKAGE_GRPC
+	select BR2_PACKAGE_GTEST
 	select BR2_PACKAGE_JQ
 	select BR2_PACKAGE_JSONCPP
 	select BR2_PACKAGE_LIBB64
 	select BR2_PACKAGE_LIBCURL
 	select BR2_PACKAGE_NCURSES
 	select BR2_PACKAGE_OPENSSL
+	select BR2_PACKAGE_PROTOBUF
+	select BR2_PACKAGE_TBB
 	select BR2_PACKAGE_ZLIB
 	help
 	  Sysdig is open source, system-level exploration:
diff --git a/package/sysdig/sysdig.hash b/package/sysdig/sysdig.hash
index 565b1e9828..4bce674f3e 100644
--- a/package/sysdig/sysdig.hash
+++ b/package/sysdig/sysdig.hash
@@ -1,3 +1,4 @@
 # sha256 locally computed
+sha256  b9d05854493d245a7a7e75f77fc654508f720aab5e5e8a3a932bd8eb54e49bda  sysdig-0.27.1.tar.gz
 sha256  57d5b713b875eba35546a1408bf3f20c2703904a17d956be115ee55272db4cfa  sysdig-0.23.1.tar.gz
 sha256  8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  COPYING
diff --git a/package/sysdig/sysdig.mk b/package/sysdig/sysdig.mk
index 08d93750ae..d497c7c381 100644
--- a/package/sysdig/sysdig.mk
+++ b/package/sysdig/sysdig.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-SYSDIG_VERSION = 0.23.1
+SYSDIG_VERSION = 0.27.1
 SYSDIG_SITE = $(call github,draios,sysdig,$(SYSDIG_VERSION))
 SYSDIG_LICENSE = GPL-2.0
 SYSDIG_LICENSE_FILES = COPYING
@@ -13,7 +13,10 @@ SYSDIG_CONF_OPTS = -DENABLE_DKMS=OFF -DUSE_BUNDLED_DEPS=OFF
 SYSDIG_SUPPORTS_IN_SOURCE_BUILD = NO
 
 SYSDIG_DEPENDENCIES = \
+	c-ares \
 	elfutils \
+	gtest \
+	grpc \
 	jq \
 	jsoncpp \
 	libb64 \
@@ -21,6 +24,8 @@ SYSDIG_DEPENDENCIES = \
 	luainterpreter \
 	ncurses \
 	openssl \
+	protobuf \
+	tbb \
 	zlib
 
 # sysdig creates the module Makefile from a template, which contains a
-- 
2.25.1

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

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

* Re: [Buildroot] [RFC PATCH v1 1/2] tbb: new package
  2022-04-07 18:24 ` [Buildroot] [RFC PATCH v1 1/2] tbb: new package Francis Laniel
@ 2022-04-09 13:42   ` Arnout Vandecappelle
  2022-04-11 18:06     ` Francis Laniel
  0 siblings, 1 reply; 7+ messages in thread
From: Arnout Vandecappelle @ 2022-04-09 13:42 UTC (permalink / raw)
  To: Francis Laniel, buildroot
  Cc: Angelo Compagnucci, bradford barr, Thomas Petazzoni

  Hi Francis,

  Thank you for this patch. I applied to master but with quite a few changes.

On 07/04/2022 20:24, Francis Laniel wrote:
> From: bradford barr <bradford@density.io>
> 
> 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.
> 
> Signed-off-by: bradford barr <bradford@density.io>
> Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
> ---
>   DEVELOPERS                                    |  1 +
>   package/Config.in                             |  1 +
>   .../0001-tbb-Enable-cross-compilation.patch   | 55 +++++++++++++++++++
>   package/tbb/Config.in                         | 16 ++++++
>   package/tbb/tbb.hash                          |  2 +
>   package/tbb/tbb.mk                            | 39 +++++++++++++
>   6 files changed, 114 insertions(+)
>   create mode 100644 package/tbb/0001-tbb-Enable-cross-compilation.patch
>   create mode 100644 package/tbb/Config.in
>   create mode 100644 package/tbb/tbb.hash
>   create mode 100644 package/tbb/tbb.mk
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index a66b9d7eee..ef4ddcab50 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -970,6 +970,7 @@ F:	package/odhcploc/
>   
>   N:	Francis Laniel <flaniel@linux.microsoft.com>
>   F:	package/pahole/
> +F:	package/tbb/
>   
>   N:	Francisco Gonzalez <gzmorell@gmail.com>
>   F:	package/ser2net/
> diff --git a/package/Config.in b/package/Config.in
> index 0d5d763180..24f7af5ea8 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -2044,6 +2044,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"
> diff --git a/package/tbb/0001-tbb-Enable-cross-compilation.patch b/package/tbb/0001-tbb-Enable-cross-compilation.patch
> new file mode 100644
> index 0000000000..652d59c47b
> --- /dev/null
> +++ b/package/tbb/0001-tbb-Enable-cross-compilation.patch
> @@ -0,0 +1,55 @@
> +From 42c3faff14917f687aab405d8f571e352ffdf3f5 Mon Sep 17 00:00:00 2001
> +From: Francis Laniel <flaniel@linux.microsoft.com>
> +Date: Wed, 6 Apr 2022 15:58:02 +0100
> +Subject: [PATCH] tbb: Enable cross-compilation.
> +
> +This patch replaces hardcoded value for CPLUS and CONLY with $(CXX) and $(CC).
> +So, by defining CC= it is possible to cross compile this library using a
> +cross-compiler.
> +
> +This patch was originally written by:
> +Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
> +and taken from:
> +https://github.com/intel/luv-yocto/blob/3b0688bc9a5e8d52b6ca461b15fb4abd3eaaf7a8/meta-oe/recipes-support/tbb/tbb/cross-compile.patch
> +
> +Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
> +---
> + build/linux.clang.inc | 5 +++--
> + build/linux.gcc.inc   | 5 +++--
> + 2 files changed, 6 insertions(+), 4 deletions(-)
> +
> +diff --git a/build/linux.clang.inc b/build/linux.clang.inc
> +index 5a459ef5..a0777db5 100644
> +--- a/build/linux.clang.inc
> ++++ b/build/linux.clang.inc
> +@@ -31,8 +31,9 @@ DYLIB_KEY = -shared
> + EXPORT_KEY = -Wl,--version-script,
> + LIBDL = -ldl
> +
> +-CPLUS = clang++
> +-CONLY = clang
> ++CPLUS = $(CXX)
> ++CONLY = $(CC)
> ++CPLUS_FLAGS = $(CXXFLAGS)

  I dropped this patch. Instead, I simply passed CPLUS, CONLY and CPLUS_FLAGS in 
the $(MAKE) call.

> + LIB_LINK_FLAGS = $(DYLIB_KEY) -Wl,-soname=$(BUILDING_LIBRARY)
> + LIBS += -lpthread -lrt
> + LINK_FLAGS = -Wl,-rpath-link=. -rdynamic
> +diff --git a/build/linux.gcc.inc b/build/linux.gcc.inc
> +index 786c4153..30242a82 100644
> +--- a/build/linux.gcc.inc
> ++++ b/build/linux.gcc.inc
> +@@ -32,8 +32,9 @@ DYLIB_KEY = -shared
> + EXPORT_KEY = -Wl,--version-script,
> + LIBDL = -ldl
> +
> +-CPLUS = g++
> +-CONLY = gcc
> ++CPLUS = $(CXX)
> ++CONLY = $(CC)
> ++CPLUS_FLAGS = $(CXXFLAGS)
> + LIB_LINK_FLAGS = $(DYLIB_KEY) -Wl,-soname=$(BUILDING_LIBRARY)
> + LIBS += -lpthread -lrt
> + LINK_FLAGS = -Wl,-rpath-link=. -rdynamic
> +--
> +2.25.1
> +
> diff --git a/package/tbb/Config.in b/package/tbb/Config.in
> new file mode 100644
> index 0000000000..0f40b74d31
> --- /dev/null
> +++ b/package/tbb/Config.in
> @@ -0,0 +1,16 @@
> +config BR2_PACKAGE_TBB
> +	bool "tbb"
> +	depends on BR2_TOOLCHAIN_USES_GLIBC
> +	depends on !BR2_STATIC_LIBS
> +	depends on BR2_TOOLCHAIN_HAS_THREADS
> +	depends on BR2_INSTALL_LIBSTDCPP
> +	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/ dynamic library, threads, C++"
> +	depends on !BR2_TOOLCHAIN_USES_GLIBC || BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
> diff --git a/package/tbb/tbb.hash b/package/tbb/tbb.hash
> new file mode 100644
> index 0000000000..e9fb7511b8
> --- /dev/null
> +++ b/package/tbb/tbb.hash
> @@ -0,0 +1,2 @@
> +# Locally calculated
> +sha256  b8dbab5aea2b70cf07844f86fa413e549e099aa3205b6a04059ca92ead93a372  tbb-2018_U5.tar.gz

  You also need to include a hash for the license file.

> diff --git a/package/tbb/tbb.mk b/package/tbb/tbb.mk
> new file mode 100644
> index 0000000000..cf06579b98
> --- /dev/null
> +++ b/package/tbb/tbb.mk
> @@ -0,0 +1,39 @@
> +################################################################################
> +#
> +# tbb
> +#
> +################################################################################
> +
> +TBB_VERSION = 2018_U5
> +TBB_SITE = $(call github,01org,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_*
> +
> +define TBB_BUILD_CMDS
> +	$(MAKE) $(TARGET_CONFIGURE_OPTS) arch=$(BR2_ARCH) -C $(@D)

  The values for arch that are used by tbb are different from the values that 
BR2_ARCH has. I studied this in more detail:

# 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.

  Regards,
  Arnout

> +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))
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [RFC PATCH v1 2/2] package/sysdig: bump version to 0.27.1.
  2022-04-07 18:24 ` [Buildroot] [RFC PATCH v1 2/2] package/sysdig: bump version to 0.27.1 Francis Laniel
@ 2022-04-09 14:40   ` Arnout Vandecappelle
  2022-04-11 18:11     ` Francis Laniel
  0 siblings, 1 reply; 7+ messages in thread
From: Arnout Vandecappelle @ 2022-04-09 14:40 UTC (permalink / raw)
  To: Francis Laniel, buildroot; +Cc: Angelo Compagnucci, Thomas Petazzoni

  Hi Francis,

On 07/04/2022 20:24, Francis Laniel wrote:
> 0.23.1 has compilation errors with recent kernels.
> 
> Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>

  I've applied to master, with a number of changes.

  I've noticed that it doesn't build on e.g. aarch64, because it uses syscalls 
like open(2) that simply don't exist on aarch64. Fixing that would be quite a 
big undertaking, and upstream has simply removed the syscall-handling code. So a 
better solution would be to update to 0.29.1. However, *that* is a fairly big 
change again because they also got rid of the kernel driver. It's easy enough to 
remove the kernel-module part on the buildroot side, but I wouldn't know if it 
still behaves correctly at runtime. So, Francis, would you care to look into 
updating to 0.29.1?

  If you do that, please also check if it requires a minimum kernel version. I 
think it uses all kinds of tracepoint or other kernel features which may not 
exist in older kernels. If it does have a minimum kernel version, please add a 
BR2_TOOLCHAIN_HEADERS_AT_LEAST_X_Y dependency (with explanation in the commit 
message how you got to that conclusion).

  Also, I added you to DEVELOPERS for this package. It won't have much effect 
other than being Cc'ed on patches, because sysdig isn't built in the 
autobuilders (since it depends on a kernel to be built and we don't do that in 
autobuilders).


> ---
>   ...ATCH_COMMAND-to-fix-lua-types-and-fu.patch | 82 +++++++++++++++++++
>   ...gainst-libabseil-cpp-which-grpc-uses.patch | 45 ++++++++++
>   package/sysdig/Config.in                      |  5 ++
>   package/sysdig/sysdig.hash                    |  1 +
>   package/sysdig/sysdig.mk                      |  7 +-
>   5 files changed, 139 insertions(+), 1 deletion(-)
>   create mode 100644 package/sysdig/0001-libsinsp-Apply-PATCH_COMMAND-to-fix-lua-types-and-fu.patch
>   create mode 100644 package/sysdig/0002-Link-against-libabseil-cpp-which-grpc-uses.patch
> 
> diff --git a/package/sysdig/0001-libsinsp-Apply-PATCH_COMMAND-to-fix-lua-types-and-fu.patch b/package/sysdig/0001-libsinsp-Apply-PATCH_COMMAND-to-fix-lua-types-and-fu.patch
> new file mode 100644
> index 0000000000..7873210281
> --- /dev/null
> +++ b/package/sysdig/0001-libsinsp-Apply-PATCH_COMMAND-to-fix-lua-types-and-fu.patch
> @@ -0,0 +1,82 @@
> +From cc8bccc3ebb90103900a7f0f2b085ddb723b8792 Mon Sep 17 00:00:00 2001
> +From: Francis Laniel <flaniel@linux.microsoft.com>
> +Date: Wed, 6 Apr 2022 16:54:37 +0100
> +Subject: [PATCH] libsinsp: Apply PATCH_COMMAND to fix lua types and function.
> +
> +Buildroot luajit 5.1 seems to not have compatibility between luaL_reg and
> +luaL_Reg.
> +So, we apply sysdig CMakeLists.txt PATCH_COMMAND to fix this and lua function
> +call as well.
> +Note that, this PATCH_COMMAND was added in sysdig in:
> +a064440394c9 ("Adding power support to Travis builds (#1566)")
> +
> +This patch is also present in kubernetes/minikube in:
> +f036c279bc59 ("Add patch for compiling sysdig with system luajit")
> +
> +Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>

  Would it be possible to send this patch upstream, so we don't need to maintain 
it going forward? Obviously, it's best to first bump to the latest version (and 
check if the patch is still needed).

[snip]
> diff --git a/package/sysdig/0002-Link-against-libabseil-cpp-which-grpc-uses.patch b/package/sysdig/0002-Link-against-libabseil-cpp-which-grpc-uses.patch
> new file mode 100644
> index 0000000000..60c3d31a3e
> --- /dev/null
> +++ b/package/sysdig/0002-Link-against-libabseil-cpp-which-grpc-uses.patch
> @@ -0,0 +1,45 @@
> +From a7fb3b863c3574470c45fdf6084dcc40931ca017 Mon Sep 17 00:00:00 2001
> +From: Francis Laniel <flaniel@linux.microsoft.com>
> +Date: Thu, 7 Apr 2022 18:30:23 +0100
> +Subject: [PATCH 2/2] Link against libabseil-cpp which grpc uses.

  Don't include the 2/2 part (use git format-patch -N). check-package reports this.

> +
> +This patch was taken from:
> +55c96b61f7b9 ("sysdig: make extra linking against abseil conditional")
> +from hhoffstaette/portage.

  I've changed this to include the full URL of where you've taken it from. I 
should have done that for th other patch as well, but I forgot.

  Also please send this patch upstream.

> +
> +Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
> +---
> + CMakeLists.txt                    | 1 +
> + userspace/libsinsp/CMakeLists.txt | 4 ++++
> + 2 files changed, 5 insertions(+)
> +
> +diff --git a/CMakeLists.txt b/CMakeLists.txt
> +index 1f34f1d6..c0354b29 100644
> +--- a/CMakeLists.txt
> ++++ b/CMakeLists.txt
> +@@ -552,6 +552,7 @@ if(NOT WIN32 AND NOT APPLE)
> + 			else()
> + 				message(FATAL_ERROR "Couldn't find system grpc")
> + 			endif()
> ++			find_library(ABSL_SYNC_LIB NAMES absl_synchronization)
> + 			find_program(GRPC_CPP_PLUGIN grpc_cpp_plugin)
> + 			if(NOT GRPC_CPP_PLUGIN)
> + 				message(FATAL_ERROR "System grpc_cpp_plugin not found")
> +diff --git a/userspace/libsinsp/CMakeLists.txt b/userspace/libsinsp/CMakeLists.txt
> +index d72f9115..d1b7ea02 100644
> +--- a/userspace/libsinsp/CMakeLists.txt
> ++++ b/userspace/libsinsp/CMakeLists.txt
> +@@ -214,6 +214,10 @@ if(NOT WIN32)
> + 				"${JQ_LIB}"
> + 				"${B64_LIB}")
> +
> ++			if(ABSL_SYNC_LIB)
> ++				target_link_libraries(sinsp "${ABSL_SYNC_LIB}")
> ++			endif()
> ++
> + 			if(NOT MUSL_OPTIMIZED_BUILD)
> + 			target_link_libraries(sinsp
> + 				rt
> +--
> +2.25.1
> +
> diff --git a/package/sysdig/Config.in b/package/sysdig/Config.in
> index 06d20c7f7b..5a7fbb50e0 100644
> --- a/package/sysdig/Config.in
> +++ b/package/sysdig/Config.in
> @@ -8,13 +8,18 @@ config BR2_PACKAGE_SYSDIG
>   	depends on BR2_USE_WCHAR # elfutils
>   	depends on BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC # elfutils
>   	depends on BR2_PACKAGE_LUAINTERPRETER_ABI_VERSION_5_1
> +	select BR2_PACKAGE_C_ARES
>   	select BR2_PACKAGE_ELFUTILS
> +	select BR2_PACKAGE_GRPC

  You also need to propagate the dependencies of grpc. For grpc, that's just a 
matter of adding grpc to the comments above, but some other packages have 
stricter dependencies.

> +	select BR2_PACKAGE_GTEST

  gtest is only required if tests are enabled, so I added the conf opt to 
disable tests instead.

>   	select BR2_PACKAGE_JQ
>   	select BR2_PACKAGE_JSONCPP
>   	select BR2_PACKAGE_LIBB64
>   	select BR2_PACKAGE_LIBCURL
>   	select BR2_PACKAGE_NCURSES
>   	select BR2_PACKAGE_OPENSSL
> +	select BR2_PACKAGE_PROTOBUF
> +	select BR2_PACKAGE_TBB
>   	select BR2_PACKAGE_ZLIB
>   	help
>   	  Sysdig is open source, system-level exploration:
> diff --git a/package/sysdig/sysdig.hash b/package/sysdig/sysdig.hash
> index 565b1e9828..4bce674f3e 100644
> --- a/package/sysdig/sysdig.hash
> +++ b/package/sysdig/sysdig.hash
> @@ -1,3 +1,4 @@
>   # sha256 locally computed
> +sha256  b9d05854493d245a7a7e75f77fc654508f720aab5e5e8a3a932bd8eb54e49bda  sysdig-0.27.1.tar.gz
>   sha256  57d5b713b875eba35546a1408bf3f20c2703904a17d956be115ee55272db4cfa  sysdig-0.23.1.tar.gz
>   sha256  8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  COPYING

  The COPYING file has changed, as shown by 'make legal-info'. Turns out that 
the license changed to Apache-2.0, except for the driver which is GPLv2 or MIT. 
So I updated the license hash and added the new license files.

> diff --git a/package/sysdig/sysdig.mk b/package/sysdig/sysdig.mk
> index 08d93750ae..d497c7c381 100644
> --- a/package/sysdig/sysdig.mk
> +++ b/package/sysdig/sysdig.mk
> @@ -4,7 +4,7 @@
>   #
>   ################################################################################
>   
> -SYSDIG_VERSION = 0.23.1
> +SYSDIG_VERSION = 0.27.1
>   SYSDIG_SITE = $(call github,draios,sysdig,$(SYSDIG_VERSION))
>   SYSDIG_LICENSE = GPL-2.0
>   SYSDIG_LICENSE_FILES = COPYING

  This needed to be updated as well for the license change, of course.

  Regards,
  Arnout

> @@ -13,7 +13,10 @@ SYSDIG_CONF_OPTS = -DENABLE_DKMS=OFF -DUSE_BUNDLED_DEPS=OFF
>   SYSDIG_SUPPORTS_IN_SOURCE_BUILD = NO
>   
>   SYSDIG_DEPENDENCIES = \
> +	c-ares \
>   	elfutils \
> +	gtest \
> +	grpc \
>   	jq \
>   	jsoncpp \
>   	libb64 \
> @@ -21,6 +24,8 @@ SYSDIG_DEPENDENCIES = \
>   	luainterpreter \
>   	ncurses \
>   	openssl \
> +	protobuf \
> +	tbb \
>   	zlib
>   
>   # sysdig creates the module Makefile from a template, which contains a
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [RFC PATCH v1 1/2] tbb: new package
  2022-04-09 13:42   ` Arnout Vandecappelle
@ 2022-04-11 18:06     ` Francis Laniel
  0 siblings, 0 replies; 7+ messages in thread
From: Francis Laniel @ 2022-04-11 18:06 UTC (permalink / raw)
  To: buildroot, Arnout Vandecappelle
  Cc: Angelo Compagnucci, bradford barr, Thomas Petazzoni

Le samedi 9 avril 2022, 14:42:59 BST Arnout Vandecappelle a écrit :
>   Hi Francis,

Hi

>   Thank you for this patch. I applied to master but with quite a few
> changes.

You are welcome and thank you for the modifications, they made the contribution 
better and I learnt some few tricks to make better buildroot contribution!

> On 07/04/2022 20:24, Francis Laniel wrote:
> > From: bradford barr <bradford@density.io>
> > 
> > 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.
> > 
> > Signed-off-by: bradford barr <bradford@density.io>
> > Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
> > ---
> > 
> >   DEVELOPERS                                    |  1 +
> >   package/Config.in                             |  1 +
> >   .../0001-tbb-Enable-cross-compilation.patch   | 55 +++++++++++++++++++
> >   package/tbb/Config.in                         | 16 ++++++
> >   package/tbb/tbb.hash                          |  2 +
> >   package/tbb/tbb.mk                            | 39 +++++++++++++
> >   6 files changed, 114 insertions(+)
> >   create mode 100644 package/tbb/0001-tbb-Enable-cross-compilation.patch
> >   create mode 100644 package/tbb/Config.in
> >   create mode 100644 package/tbb/tbb.hash
> >   create mode 100644 package/tbb/tbb.mk
> > 
> > diff --git a/DEVELOPERS b/DEVELOPERS
> > index a66b9d7eee..ef4ddcab50 100644
> > --- a/DEVELOPERS
> > +++ b/DEVELOPERS
> > @@ -970,6 +970,7 @@ F:	package/odhcploc/
> > 
> >   N:	Francis Laniel <flaniel@linux.microsoft.com>
> >   F:	package/pahole/
> > 
> > +F:	package/tbb/
> > 
> >   N:	Francisco Gonzalez <gzmorell@gmail.com>
> >   F:	package/ser2net/
> > 
> > diff --git a/package/Config.in b/package/Config.in
> > index 0d5d763180..24f7af5ea8 100644
> > --- a/package/Config.in
> > +++ b/package/Config.in
> > @@ -2044,6 +2044,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"
> > 
> > diff --git a/package/tbb/0001-tbb-Enable-cross-compilation.patch
> > b/package/tbb/0001-tbb-Enable-cross-compilation.patch new file mode
> > 100644
> > index 0000000000..652d59c47b
> > --- /dev/null
> > +++ b/package/tbb/0001-tbb-Enable-cross-compilation.patch
> > @@ -0,0 +1,55 @@
> > +From 42c3faff14917f687aab405d8f571e352ffdf3f5 Mon Sep 17 00:00:00 2001
> > +From: Francis Laniel <flaniel@linux.microsoft.com>
> > +Date: Wed, 6 Apr 2022 15:58:02 +0100
> > +Subject: [PATCH] tbb: Enable cross-compilation.
> > +
> > +This patch replaces hardcoded value for CPLUS and CONLY with $(CXX) and
> > $(CC). +So, by defining CC= it is possible to cross compile this library
> > using a +cross-compiler.
> > +
> > +This patch was originally written by:
> > +Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
> > +and taken from:
> > +https://github.com/intel/luv-yocto/blob/3b0688bc9a5e8d52b6ca461b15fb4abd3
> > eaaf7a8/meta-oe/recipes-support/tbb/tbb/cross-compile.patch +
> > +Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
> > +---
> > + build/linux.clang.inc | 5 +++--
> > + build/linux.gcc.inc   | 5 +++--
> > + 2 files changed, 6 insertions(+), 4 deletions(-)
> > +
> > +diff --git a/build/linux.clang.inc b/build/linux.clang.inc
> > +index 5a459ef5..a0777db5 100644
> > +--- a/build/linux.clang.inc
> > ++++ b/build/linux.clang.inc
> > +@@ -31,8 +31,9 @@ DYLIB_KEY = -shared
> > + EXPORT_KEY = -Wl,--version-script,
> > + LIBDL = -ldl
> > +
> > +-CPLUS = clang++
> > +-CONLY = clang
> > ++CPLUS = $(CXX)
> > ++CONLY = $(CC)
> > ++CPLUS_FLAGS = $(CXXFLAGS)
> 
>   I dropped this patch. Instead, I simply passed CPLUS, CONLY and
> CPLUS_FLAGS in the $(MAKE) call.
> 
> > + LIB_LINK_FLAGS = $(DYLIB_KEY) -Wl,-soname=$(BUILDING_LIBRARY)
> > + LIBS += -lpthread -lrt
> > + LINK_FLAGS = -Wl,-rpath-link=. -rdynamic
> > +diff --git a/build/linux.gcc.inc b/build/linux.gcc.inc
> > +index 786c4153..30242a82 100644
> > +--- a/build/linux.gcc.inc
> > ++++ b/build/linux.gcc.inc
> > +@@ -32,8 +32,9 @@ DYLIB_KEY = -shared
> > + EXPORT_KEY = -Wl,--version-script,
> > + LIBDL = -ldl
> > +
> > +-CPLUS = g++
> > +-CONLY = gcc
> > ++CPLUS = $(CXX)
> > ++CONLY = $(CC)
> > ++CPLUS_FLAGS = $(CXXFLAGS)
> > + LIB_LINK_FLAGS = $(DYLIB_KEY) -Wl,-soname=$(BUILDING_LIBRARY)
> > + LIBS += -lpthread -lrt
> > + LINK_FLAGS = -Wl,-rpath-link=. -rdynamic
> > +--
> > +2.25.1
> > +
> > diff --git a/package/tbb/Config.in b/package/tbb/Config.in
> > new file mode 100644
> > index 0000000000..0f40b74d31
> > --- /dev/null
> > +++ b/package/tbb/Config.in
> > @@ -0,0 +1,16 @@
> > +config BR2_PACKAGE_TBB
> > +	bool "tbb"
> > +	depends on BR2_TOOLCHAIN_USES_GLIBC
> > +	depends on !BR2_STATIC_LIBS
> > +	depends on BR2_TOOLCHAIN_HAS_THREADS
> > +	depends on BR2_INSTALL_LIBSTDCPP
> > +	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/ dynamic library, threads, C++"
> > +	depends on !BR2_TOOLCHAIN_USES_GLIBC || BR2_STATIC_LIBS ||
> > !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP diff --git
> > a/package/tbb/tbb.hash b/package/tbb/tbb.hash
> > new file mode 100644
> > index 0000000000..e9fb7511b8
> > --- /dev/null
> > +++ b/package/tbb/tbb.hash
> > @@ -0,0 +1,2 @@
> > +# Locally calculated
> > +sha256  b8dbab5aea2b70cf07844f86fa413e549e099aa3205b6a04059ca92ead93a372 
> > tbb-2018_U5.tar.gz
>   You also need to include a hash for the license file.
> 
> > diff --git a/package/tbb/tbb.mk b/package/tbb/tbb.mk
> > new file mode 100644
> > index 0000000000..cf06579b98
> > --- /dev/null
> > +++ b/package/tbb/tbb.mk
> > @@ -0,0 +1,39 @@
> > +#########################################################################
> > ####### +#
> > +# tbb
> > +#
> > +#########################################################################
> > ####### +
> > +TBB_VERSION = 2018_U5
> > +TBB_SITE = $(call github,01org,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_*
> > +
> > +define TBB_BUILD_CMDS
> > +	$(MAKE) $(TARGET_CONFIGURE_OPTS) arch=$(BR2_ARCH) -C $(@D)
> 
>   The values for arch that are used by tbb are different from the values
> that BR2_ARCH has. I studied this in more detail:
> 
> # 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.
> 
>   Regards,
>   Arnout
> 
> > +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))




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

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

* Re: [Buildroot] [RFC PATCH v1 2/2] package/sysdig: bump version to 0.27.1.
  2022-04-09 14:40   ` Arnout Vandecappelle
@ 2022-04-11 18:11     ` Francis Laniel
  0 siblings, 0 replies; 7+ messages in thread
From: Francis Laniel @ 2022-04-11 18:11 UTC (permalink / raw)
  To: buildroot, Arnout Vandecappelle; +Cc: Angelo Compagnucci, Thomas Petazzoni

Le samedi 9 avril 2022, 15:40:20 BST Arnout Vandecappelle a écrit :
>   Hi Francis,

Hi.

> On 07/04/2022 20:24, Francis Laniel wrote:
> > 0.23.1 has compilation errors with recent kernels.
> > 
> > Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
> 
>   I've applied to master, with a number of changes.

Thank you for it.

>   I've noticed that it doesn't build on e.g. aarch64, because it uses
> syscalls like open(2) that simply don't exist on aarch64. Fixing that would
> be quite a big undertaking, and upstream has simply removed the
> syscall-handling code. So a better solution would be to update to 0.29.1.
> However, *that* is a fairly big change again because they also got rid of
> the kernel driver. It's easy enough to remove the kernel-module part on the
> buildroot side, but I wouldn't know if it still behaves correctly at
> runtime. So, Francis, would you care to look into updating to 0.29.1?

I will try to update sysdig to this version but I sadly cannot give any date 
of delivery.
Indeed, I am bit worried is that after 0.27.1 sysdig depends of falco/libs and 
I do not really know how to handle this.

>   If you do that, please also check if it requires a minimum kernel version.
> I think it uses all kinds of tracepoint or other kernel features which may
> not exist in older kernels. If it does have a minimum kernel version,
> please add a BR2_TOOLCHAIN_HEADERS_AT_LEAST_X_Y dependency (with
> explanation in the commit message how you got to that conclusion).
> 
>   Also, I added you to DEVELOPERS for this package. It won't have much
> effect other than being Cc'ed on patches, because sysdig isn't built in the
> autobuilders (since it depends on a kernel to be built and we don't do that
> in autobuilders).
> 
> > ---
> > 
> >   ...ATCH_COMMAND-to-fix-lua-types-and-fu.patch | 82 +++++++++++++++++++
> >   ...gainst-libabseil-cpp-which-grpc-uses.patch | 45 ++++++++++
> >   package/sysdig/Config.in                      |  5 ++
> >   package/sysdig/sysdig.hash                    |  1 +
> >   package/sysdig/sysdig.mk                      |  7 +-
> >   5 files changed, 139 insertions(+), 1 deletion(-)
> >   create mode 100644
> >   package/sysdig/0001-libsinsp-Apply-PATCH_COMMAND-to-fix-lua-types-and-f
> >   u.patch create mode 100644
> >   package/sysdig/0002-Link-against-libabseil-cpp-which-grpc-uses.patch> 
> > diff --git
> > a/package/sysdig/0001-libsinsp-Apply-PATCH_COMMAND-to-fix-lua-types-and-f
> > u.patch
> > b/package/sysdig/0001-libsinsp-Apply-PATCH_COMMAND-to-fix-lua-types-and-f
> > u.patch new file mode 100644
> > index 0000000000..7873210281
> > --- /dev/null
> > +++
> > b/package/sysdig/0001-libsinsp-Apply-PATCH_COMMAND-to-fix-lua-types-and-f
> > u.patch @@ -0,0 +1,82 @@
> > +From cc8bccc3ebb90103900a7f0f2b085ddb723b8792 Mon Sep 17 00:00:00 2001
> > +From: Francis Laniel <flaniel@linux.microsoft.com>
> > +Date: Wed, 6 Apr 2022 16:54:37 +0100
> > +Subject: [PATCH] libsinsp: Apply PATCH_COMMAND to fix lua types and
> > function. +
> > +Buildroot luajit 5.1 seems to not have compatibility between luaL_reg and
> > +luaL_Reg.
> > +So, we apply sysdig CMakeLists.txt PATCH_COMMAND to fix this and lua
> > function +call as well.
> > +Note that, this PATCH_COMMAND was added in sysdig in:
> > +a064440394c9 ("Adding power support to Travis builds (#1566)")
> > +
> > +This patch is also present in kubernetes/minikube in:
> > +f036c279bc59 ("Add patch for compiling sysdig with system luajit")
> > +
> > +Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
> 
>   Would it be possible to send this patch upstream, so we don't need to
> maintain it going forward? Obviously, it's best to first bump to the latest
> version (and check if the patch is still needed).
> 
> [snip]
> 
> > diff --git
> > a/package/sysdig/0002-Link-against-libabseil-cpp-which-grpc-uses.patch
> > b/package/sysdig/0002-Link-against-libabseil-cpp-which-grpc-uses.patch
> > new file mode 100644
> > index 0000000000..60c3d31a3e
> > --- /dev/null
> > +++ b/package/sysdig/0002-Link-against-libabseil-cpp-which-grpc-uses.patch
> > @@ -0,0 +1,45 @@
> > +From a7fb3b863c3574470c45fdf6084dcc40931ca017 Mon Sep 17 00:00:00 2001
> > +From: Francis Laniel <flaniel@linux.microsoft.com>
> > +Date: Thu, 7 Apr 2022 18:30:23 +0100
> > +Subject: [PATCH 2/2] Link against libabseil-cpp which grpc uses.
> 
>   Don't include the 2/2 part (use git format-patch -N). check-package
> reports this.
> > +
> > +This patch was taken from:
> > +55c96b61f7b9 ("sysdig: make extra linking against abseil conditional")
> > +from hhoffstaette/portage.
> 
>   I've changed this to include the full URL of where you've taken it from. I
> should have done that for th other patch as well, but I forgot.
> 
>   Also please send this patch upstream.

For the luajit and abseil patch, I will first check if 0.29.1 still needs them.
If so, I will for sure send these patches upstream!

> > +
> > +Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
> > +---
> > + CMakeLists.txt                    | 1 +
> > + userspace/libsinsp/CMakeLists.txt | 4 ++++
> > + 2 files changed, 5 insertions(+)
> > +
> > +diff --git a/CMakeLists.txt b/CMakeLists.txt
> > +index 1f34f1d6..c0354b29 100644
> > +--- a/CMakeLists.txt
> > ++++ b/CMakeLists.txt
> > +@@ -552,6 +552,7 @@ if(NOT WIN32 AND NOT APPLE)
> > + 			else()
> > + 				message(FATAL_ERROR "Couldn't find system grpc")
> > + 			endif()
> > ++			find_library(ABSL_SYNC_LIB NAMES absl_synchronization)
> > + 			find_program(GRPC_CPP_PLUGIN grpc_cpp_plugin)
> > + 			if(NOT GRPC_CPP_PLUGIN)
> > + 				message(FATAL_ERROR "System grpc_cpp_plugin not 
found")
> > +diff --git a/userspace/libsinsp/CMakeLists.txt
> > b/userspace/libsinsp/CMakeLists.txt +index d72f9115..d1b7ea02 100644
> > +--- a/userspace/libsinsp/CMakeLists.txt
> > ++++ b/userspace/libsinsp/CMakeLists.txt
> > +@@ -214,6 +214,10 @@ if(NOT WIN32)
> > + 				"${JQ_LIB}"
> > + 				"${B64_LIB}")
> > +
> > ++			if(ABSL_SYNC_LIB)
> > ++				target_link_libraries(sinsp "${ABSL_SYNC_LIB}")
> > ++			endif()
> > ++
> > + 			if(NOT MUSL_OPTIMIZED_BUILD)
> > + 			target_link_libraries(sinsp
> > + 				rt
> > +--
> > +2.25.1
> > +
> > diff --git a/package/sysdig/Config.in b/package/sysdig/Config.in
> > index 06d20c7f7b..5a7fbb50e0 100644
> > --- a/package/sysdig/Config.in
> > +++ b/package/sysdig/Config.in
> > @@ -8,13 +8,18 @@ config BR2_PACKAGE_SYSDIG
> > 
> >   	depends on BR2_USE_WCHAR # elfutils
> >   	depends on BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC #
> >   	elfutils
> >   	depends on BR2_PACKAGE_LUAINTERPRETER_ABI_VERSION_5_1
> > 
> > +	select BR2_PACKAGE_C_ARES
> > 
> >   	select BR2_PACKAGE_ELFUTILS
> > 
> > +	select BR2_PACKAGE_GRPC
> 
>   You also need to propagate the dependencies of grpc. For grpc, that's just
> a matter of adding grpc to the comments above, but some other packages have
> stricter dependencies.
> 
> > +	select BR2_PACKAGE_GTEST
> 
>   gtest is only required if tests are enabled, so I added the conf opt to
> disable tests instead.
> 
> >   	select BR2_PACKAGE_JQ
> >   	select BR2_PACKAGE_JSONCPP
> >   	select BR2_PACKAGE_LIBB64
> >   	select BR2_PACKAGE_LIBCURL
> >   	select BR2_PACKAGE_NCURSES
> >   	select BR2_PACKAGE_OPENSSL
> > 
> > +	select BR2_PACKAGE_PROTOBUF
> > +	select BR2_PACKAGE_TBB
> > 
> >   	select BR2_PACKAGE_ZLIB
> >   	help
> >   	
> >   	  Sysdig is open source, system-level exploration:
> > diff --git a/package/sysdig/sysdig.hash b/package/sysdig/sysdig.hash
> > index 565b1e9828..4bce674f3e 100644
> > --- a/package/sysdig/sysdig.hash
> > +++ b/package/sysdig/sysdig.hash
> > @@ -1,3 +1,4 @@
> > 
> >   # sha256 locally computed
> > 
> > +sha256  b9d05854493d245a7a7e75f77fc654508f720aab5e5e8a3a932bd8eb54e49bda 
> > sysdig-0.27.1.tar.gz> 
> >   sha256  57d5b713b875eba35546a1408bf3f20c2703904a17d956be115ee55272db4cfa
> >    sysdig-0.23.1.tar.gz sha256 
> >   8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 
> >   COPYING
>   The COPYING file has changed, as shown by 'make legal-info'. Turns out
> that the license changed to Apache-2.0, except for the driver which is
> GPLv2 or MIT. So I updated the license hash and added the new license
> files.
> 
> > diff --git a/package/sysdig/sysdig.mk b/package/sysdig/sysdig.mk
> > index 08d93750ae..d497c7c381 100644
> > --- a/package/sysdig/sysdig.mk
> > +++ b/package/sysdig/sysdig.mk
> > @@ -4,7 +4,7 @@
> > 
> >   #
> >   ########################################################################
> >   ########> 
> > -SYSDIG_VERSION = 0.23.1
> > +SYSDIG_VERSION = 0.27.1
> > 
> >   SYSDIG_SITE = $(call github,draios,sysdig,$(SYSDIG_VERSION))
> >   SYSDIG_LICENSE = GPL-2.0
> >   SYSDIG_LICENSE_FILES = COPYING
> 
>   This needed to be updated as well for the license change, of course.
> 
>   Regards,
>   Arnout
> 
> > @@ -13,7 +13,10 @@ SYSDIG_CONF_OPTS = -DENABLE_DKMS=OFF
> > -DUSE_BUNDLED_DEPS=OFF> 
> >   SYSDIG_SUPPORTS_IN_SOURCE_BUILD = NO
> >   
> >   SYSDIG_DEPENDENCIES = \
> > 
> > +	c-ares \
> > 
> >   	elfutils \
> > 
> > +	gtest \
> > +	grpc \
> > 
> >   	jq \
> >   	jsoncpp \
> >   	libb64 \
> > 
> > @@ -21,6 +24,8 @@ SYSDIG_DEPENDENCIES = \
> > 
> >   	luainterpreter \
> >   	ncurses \
> >   	openssl \
> > 
> > +	protobuf \
> > +	tbb \
> > 
> >   	zlib
> >   
> >   # sysdig creates the module Makefile from a template, which contains a




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

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

end of thread, other threads:[~2022-04-11 18:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-07 18:24 [Buildroot] [RFC PATCH v1 0/2] Fix sysdig build errors Francis Laniel
2022-04-07 18:24 ` [Buildroot] [RFC PATCH v1 1/2] tbb: new package Francis Laniel
2022-04-09 13:42   ` Arnout Vandecappelle
2022-04-11 18:06     ` Francis Laniel
2022-04-07 18:24 ` [Buildroot] [RFC PATCH v1 2/2] package/sysdig: bump version to 0.27.1 Francis Laniel
2022-04-09 14:40   ` Arnout Vandecappelle
2022-04-11 18:11     ` Francis Laniel

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.