diff options
5 files changed, 159 insertions, 146 deletions
diff --git a/meta-oe/recipes-extended/sysdig/sysdig/0001-Fix-build-with-musl-backtrace-APIs-are-glibc-specifi.patch b/meta-oe/recipes-extended/sysdig/sysdig/0001-Fix-build-with-musl-backtrace-APIs-are-glibc-specifi.patch index 7d3f8a19d7..cb80611578 100644 --- a/meta-oe/recipes-extended/sysdig/sysdig/0001-Fix-build-with-musl-backtrace-APIs-are-glibc-specifi.patch +++ b/meta-oe/recipes-extended/sysdig/sysdig/0001-Fix-build-with-musl-backtrace-APIs-are-glibc-specifi.patch | |||
@@ -9,42 +9,41 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
9 | userspace/libsinsp/utils.h | 2 +- | 9 | userspace/libsinsp/utils.h | 2 +- |
10 | 2 files changed, 4 insertions(+), 2 deletions(-) | 10 | 2 files changed, 4 insertions(+), 2 deletions(-) |
11 | 11 | ||
12 | diff --git a/userspace/libsinsp/utils.cpp b/userspace/libsinsp/utils.cpp | ||
13 | index 8f23f9c..c496a57 100644 | ||
14 | --- a/userspace/libsinsp/utils.cpp | 12 | --- a/userspace/libsinsp/utils.cpp |
15 | +++ b/userspace/libsinsp/utils.cpp | 13 | +++ b/userspace/libsinsp/utils.cpp |
16 | @@ -21,7 +21,9 @@ along with sysdig. If not, see <http://www.gnu.org/licenses/>. | 14 | @@ -22,7 +22,7 @@ limitations under the License. |
17 | #include <limits.h> | 15 | #include <limits.h> |
18 | #include <stdlib.h> | 16 | #include <stdlib.h> |
19 | #include <sys/time.h> | 17 | #include <sys/time.h> |
20 | +#ifdef __GLIBC__ | 18 | -#ifndef CYGWING_AGENT |
19 | +#if !defined(CYGWING_AGENT) || defined(__GLIBC__) | ||
21 | #include <execinfo.h> | 20 | #include <execinfo.h> |
22 | +#endif | 21 | #endif |
23 | #include <unistd.h> | 22 | #include <unistd.h> |
24 | #include <sys/time.h> | 23 | @@ -780,6 +780,7 @@ bool sinsp_utils::glob_match(const char |
25 | #include <netdb.h> | ||
26 | @@ -741,7 +743,7 @@ uint64_t sinsp_utils::get_current_time_ns() | ||
27 | return tv.tv_sec * (uint64_t) 1000000000 + tv.tv_usec * 1000; | ||
28 | } | ||
29 | 24 | ||
30 | -#ifndef _WIN32 | 25 | #ifndef CYGWING_AGENT |
31 | +#if defined(_WIN32) && defined(__GLIBC__) | 26 | #ifndef _WIN32 |
27 | +#ifdef __GLIBC__ | ||
32 | void sinsp_utils::bt(void) | 28 | void sinsp_utils::bt(void) |
33 | { | 29 | { |
34 | static const char start[] = "BACKTRACE ------------"; | 30 | static const char start[] = "BACKTRACE ------------"; |
35 | diff --git a/userspace/libsinsp/utils.h b/userspace/libsinsp/utils.h | 31 | @@ -801,6 +802,7 @@ void sinsp_utils::bt(void) |
36 | index 600d00b..4ab4650 100644 | 32 | |
33 | free(bt_syms); | ||
34 | } | ||
35 | +#endif // Glibc | ||
36 | #endif // _WIN32 | ||
37 | #endif // CYGWING_AGENT | ||
38 | |||
37 | --- a/userspace/libsinsp/utils.h | 39 | --- a/userspace/libsinsp/utils.h |
38 | +++ b/userspace/libsinsp/utils.h | 40 | +++ b/userspace/libsinsp/utils.h |
39 | @@ -79,7 +79,7 @@ public: | 41 | @@ -104,7 +104,7 @@ public: |
40 | 42 | ||
41 | static uint64_t get_current_time_ns(); | 43 | static bool glob_match(const char *pattern, const char *string); |
42 | 44 | ||
43 | -#ifndef _WIN32 | 45 | -#ifndef _WIN32 |
44 | +#if not defined(_WIN32) && defined(__GLIBC__) | 46 | +#if not defined(_WIN32) && defined(__GLIBC__) |
45 | // | 47 | // |
46 | // Print the call stack | 48 | // Print the call stack |
47 | // | 49 | // |
48 | -- | ||
49 | 2.6.2 | ||
50 | |||
diff --git a/meta-oe/recipes-extended/sysdig/sysdig/0001-fix-build-with-LuaJIT-2.1-betas.patch b/meta-oe/recipes-extended/sysdig/sysdig/0001-fix-build-with-LuaJIT-2.1-betas.patch new file mode 100644 index 0000000000..71b0b8c8b9 --- /dev/null +++ b/meta-oe/recipes-extended/sysdig/sysdig/0001-fix-build-with-LuaJIT-2.1-betas.patch | |||
@@ -0,0 +1,96 @@ | |||
1 | From ae82de664a6ba6ab2654adf9bed81f22b6fdc19d Mon Sep 17 00:00:00 2001 | ||
2 | From: Evgeni Golov <evgeni@golov.de> | ||
3 | Date: Sun, 27 Aug 2017 13:51:19 +0200 | ||
4 | Subject: [PATCH] fix build with LuaJIT 2.1 betas | ||
5 | |||
6 | LuaJIT 2.1 drops some compat symbols [1]. And while I think that this is | ||
7 | wrong, as it breaks compatibility with Lua 5.1 [2], it is quite easy to | ||
8 | adopt the code to work with both versions (2.0 and 2.1) of LuaJIT and | ||
9 | remain Lua 5.1 compatible. | ||
10 | |||
11 | [1] https://github.com/LuaJIT/LuaJIT/commit/dc320ca70f2c5bb3977b82853bcee6dad2523d01 | ||
12 | [2] https://github.com/LuaJIT/LuaJIT/issues/325 | ||
13 | |||
14 | Upstream-Status: Submitted [https://github.com/LuaJIT/LuaJIT/issues/325] | ||
15 | Signed-off-by: Evgeni Golov <evgeni@golov.de> | ||
16 | sysdig-CLA-1.0-signed-off-by: Evgeni Golov <evgeni@golov.de> | ||
17 | --- | ||
18 | CMakeLists.txt | 2 +- | ||
19 | userspace/libsinsp/chisel.cpp | 6 +++--- | ||
20 | userspace/libsinsp/lua_parser.cpp | 2 +- | ||
21 | userspace/libsinsp/lua_parser_api.cpp | 2 +- | ||
22 | 4 files changed, 6 insertions(+), 6 deletions(-) | ||
23 | |||
24 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
25 | index d7020493..33e524f5 100644 | ||
26 | --- a/CMakeLists.txt | ||
27 | +++ b/CMakeLists.txt | ||
28 | @@ -140,7 +140,7 @@ option(USE_BUNDLED_DEPS "Enable bundled dependencies instead of using the system | ||
29 | option(USE_BUNDLED_LUAJIT "Enable building of the bundled LuaJIT" ${USE_BUNDLED_DEPS}) | ||
30 | |||
31 | if(NOT USE_BUNDLED_LUAJIT) | ||
32 | - find_path(LUAJIT_INCLUDE luajit.h PATH_SUFFIXES luajit-2.0 luajit) | ||
33 | + find_path(LUAJIT_INCLUDE luajit.h PATH_SUFFIXES luajit-2.1 luajit-2.0 luajit) | ||
34 | find_library(LUAJIT_LIB NAMES luajit luajit-5.1) | ||
35 | if(LUAJIT_INCLUDE AND LUAJIT_LIB) | ||
36 | message(STATUS "Found LuaJIT: include: ${LUAJIT_INCLUDE}, lib: ${LUAJIT_LIB}") | ||
37 | diff --git a/userspace/libsinsp/chisel.cpp b/userspace/libsinsp/chisel.cpp | ||
38 | index 0a6e3cf8..0c2e255a 100644 | ||
39 | --- a/userspace/libsinsp/chisel.cpp | ||
40 | +++ b/userspace/libsinsp/chisel.cpp | ||
41 | @@ -98,7 +98,7 @@ void lua_stackdump(lua_State *L) | ||
42 | // Lua callbacks | ||
43 | /////////////////////////////////////////////////////////////////////////////// | ||
44 | #ifdef HAS_LUA_CHISELS | ||
45 | -const static struct luaL_reg ll_sysdig [] = | ||
46 | +const static struct luaL_Reg ll_sysdig [] = | ||
47 | { | ||
48 | {"set_filter", &lua_cbacks::set_global_filter}, | ||
49 | {"set_snaplen", &lua_cbacks::set_snaplen}, | ||
50 | @@ -134,7 +134,7 @@ const static struct luaL_reg ll_sysdig [] = | ||
51 | {NULL,NULL} | ||
52 | }; | ||
53 | |||
54 | -const static struct luaL_reg ll_chisel [] = | ||
55 | +const static struct luaL_Reg ll_chisel [] = | ||
56 | { | ||
57 | {"request_field", &lua_cbacks::request_field}, | ||
58 | {"set_filter", &lua_cbacks::set_filter}, | ||
59 | @@ -146,7 +146,7 @@ const static struct luaL_reg ll_chisel [] = | ||
60 | {NULL,NULL} | ||
61 | }; | ||
62 | |||
63 | -const static struct luaL_reg ll_evt [] = | ||
64 | +const static struct luaL_Reg ll_evt [] = | ||
65 | { | ||
66 | {"field", &lua_cbacks::field}, | ||
67 | {"get_num", &lua_cbacks::get_num}, | ||
68 | diff --git a/userspace/libsinsp/lua_parser.cpp b/userspace/libsinsp/lua_parser.cpp | ||
69 | index 0e26617d..78810d96 100644 | ||
70 | --- a/userspace/libsinsp/lua_parser.cpp | ||
71 | +++ b/userspace/libsinsp/lua_parser.cpp | ||
72 | @@ -32,7 +32,7 @@ extern "C" { | ||
73 | #include "lauxlib.h" | ||
74 | } | ||
75 | |||
76 | -const static struct luaL_reg ll_filter [] = | ||
77 | +const static struct luaL_Reg ll_filter [] = | ||
78 | { | ||
79 | {"rel_expr", &lua_parser_cbacks::rel_expr}, | ||
80 | {"bool_op", &lua_parser_cbacks::bool_op}, | ||
81 | diff --git a/userspace/libsinsp/lua_parser_api.cpp b/userspace/libsinsp/lua_parser_api.cpp | ||
82 | index c89e9126..e0169fe1 100644 | ||
83 | --- a/userspace/libsinsp/lua_parser_api.cpp | ||
84 | +++ b/userspace/libsinsp/lua_parser_api.cpp | ||
85 | @@ -266,7 +266,7 @@ int lua_parser_cbacks::rel_expr(lua_State *ls) | ||
86 | string err = "Got non-table as in-expression operand\n"; | ||
87 | throw sinsp_exception("parser API error"); | ||
88 | } | ||
89 | - int n = luaL_getn(ls, 4); /* get size of table */ | ||
90 | + int n = (int)lua_objlen(ls, 4); /* get size of table */ | ||
91 | for (i=1; i<=n; i++) | ||
92 | { | ||
93 | lua_rawgeti(ls, 4, i); | ||
94 | -- | ||
95 | 2.25.1 | ||
96 | |||
diff --git a/meta-oe/recipes-extended/sysdig/sysdig/0001-libsinsp-Port-to-build-with-lua-5.2.patch b/meta-oe/recipes-extended/sysdig/sysdig/0001-libsinsp-Port-to-build-with-lua-5.2.patch deleted file mode 100644 index 8fec0ca59f..0000000000 --- a/meta-oe/recipes-extended/sysdig/sysdig/0001-libsinsp-Port-to-build-with-lua-5.2.patch +++ /dev/null | |||
@@ -1,108 +0,0 @@ | |||
1 | From c2782a6ca968190e221c25b0890600ba8cd43798 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Fri, 23 Oct 2015 00:23:15 -0700 | ||
4 | Subject: [PATCH] libsinsp: Port to build with lua >= 5.2 | ||
5 | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
7 | --- | ||
8 | userspace/libsinsp/chisel.cpp | 40 +++++++++++++++++++++++++++++----------- | ||
9 | 1 file changed, 29 insertions(+), 11 deletions(-) | ||
10 | |||
11 | diff --git a/userspace/libsinsp/chisel.cpp b/userspace/libsinsp/chisel.cpp | ||
12 | index 3cfbd8d..2db9348 100644 | ||
13 | --- a/userspace/libsinsp/chisel.cpp | ||
14 | +++ b/userspace/libsinsp/chisel.cpp | ||
15 | @@ -94,7 +94,7 @@ void lua_stackdump(lua_State *L) | ||
16 | // Lua callbacks | ||
17 | /////////////////////////////////////////////////////////////////////////////// | ||
18 | #ifdef HAS_LUA_CHISELS | ||
19 | -const static struct luaL_reg ll_sysdig [] = | ||
20 | +const static struct luaL_Reg ll_sysdig [] = | ||
21 | { | ||
22 | {"set_filter", &lua_cbacks::set_global_filter}, | ||
23 | {"set_snaplen", &lua_cbacks::set_snaplen}, | ||
24 | @@ -120,7 +120,7 @@ const static struct luaL_reg ll_sysdig [] = | ||
25 | {NULL,NULL} | ||
26 | }; | ||
27 | |||
28 | -const static struct luaL_reg ll_chisel [] = | ||
29 | +const static struct luaL_Reg ll_chisel [] = | ||
30 | { | ||
31 | {"request_field", &lua_cbacks::request_field}, | ||
32 | {"set_filter", &lua_cbacks::set_filter}, | ||
33 | @@ -131,7 +131,7 @@ const static struct luaL_reg ll_chisel [] = | ||
34 | {NULL,NULL} | ||
35 | }; | ||
36 | |||
37 | -const static struct luaL_reg ll_evt [] = | ||
38 | +const static struct luaL_Reg ll_evt [] = | ||
39 | { | ||
40 | {"field", &lua_cbacks::field}, | ||
41 | {"get_num", &lua_cbacks::get_num}, | ||
42 | @@ -853,10 +853,28 @@ bool sinsp_chisel::parse_view_info(lua_State *ls, OUT chisel_desc* cd) | ||
43 | |||
44 | |||
45 | #ifdef HAS_LUA_CHISELS | ||
46 | +static void chisel_lua_registerlib(lua_State *L, const char *libname, | ||
47 | + const luaL_Reg *l, int ind) | ||
48 | +{ | ||
49 | +#if LUA_VERSION_NUM >= 502 | ||
50 | + if (libname) | ||
51 | + { | ||
52 | + lua_newtable(L); | ||
53 | + luaL_setfuncs(L, l, ind); | ||
54 | + lua_pushvalue(L, -1); | ||
55 | + lua_setglobal(L, libname); | ||
56 | + } | ||
57 | + else | ||
58 | + luaL_setfuncs(L, l, ind); | ||
59 | +#else | ||
60 | + luaL_register(L, libname, l); | ||
61 | +#endif | ||
62 | +} | ||
63 | + | ||
64 | // Initializes a lua chisel | ||
65 | bool sinsp_chisel::init_lua_chisel(chisel_desc &cd, string const &fpath) | ||
66 | { | ||
67 | - lua_State* ls = lua_open(); | ||
68 | + lua_State* ls = luaL_newstate(); | ||
69 | if(ls == NULL) | ||
70 | { | ||
71 | return false; | ||
72 | @@ -867,9 +885,9 @@ bool sinsp_chisel::init_lua_chisel(chisel_desc &cd, string const &fpath) | ||
73 | // | ||
74 | // Load our own lua libs | ||
75 | // | ||
76 | - luaL_openlib(ls, "sysdig", ll_sysdig, 0); | ||
77 | - luaL_openlib(ls, "chisel", ll_chisel, 0); | ||
78 | - luaL_openlib(ls, "evt", ll_evt, 0); | ||
79 | + chisel_lua_registerlib(ls, "sysdig", ll_sysdig, 0); | ||
80 | + chisel_lua_registerlib(ls, "chisel", ll_chisel, 0); | ||
81 | + chisel_lua_registerlib(ls, "evt", ll_evt, 0); | ||
82 | |||
83 | // | ||
84 | // Add our chisel paths to package.path | ||
85 | @@ -1111,16 +1129,16 @@ void sinsp_chisel::load(string cmdstr) | ||
86 | // | ||
87 | // Open the script | ||
88 | // | ||
89 | - m_ls = lua_open(); | ||
90 | + m_ls = luaL_newstate(); | ||
91 | |||
92 | luaL_openlibs(m_ls); | ||
93 | |||
94 | // | ||
95 | // Load our own lua libs | ||
96 | // | ||
97 | - luaL_openlib(m_ls, "sysdig", ll_sysdig, 0); | ||
98 | - luaL_openlib(m_ls, "chisel", ll_chisel, 0); | ||
99 | - luaL_openlib(m_ls, "evt", ll_evt, 0); | ||
100 | + chisel_lua_registerlib(m_ls, "sysdig", ll_sysdig, 0); | ||
101 | + chisel_lua_registerlib(m_ls, "chisel", ll_chisel, 0); | ||
102 | + chisel_lua_registerlib(m_ls, "evt", ll_evt, 0); | ||
103 | |||
104 | // | ||
105 | // Add our chisel paths to package.path | ||
106 | -- | ||
107 | 2.6.2 | ||
108 | |||
diff --git a/meta-oe/recipes-extended/sysdig/sysdig/fix-uint64-const.patch b/meta-oe/recipes-extended/sysdig/sysdig/fix-uint64-const.patch new file mode 100644 index 0000000000..5c756294b9 --- /dev/null +++ b/meta-oe/recipes-extended/sysdig/sysdig/fix-uint64-const.patch | |||
@@ -0,0 +1,16 @@ | |||
1 | Fix x86 build | ||
2 | |||
3 | Upstream-Status: Pending | ||
4 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
5 | |||
6 | --- a/userspace/libsinsp/cgroup_limits.cpp | ||
7 | +++ b/userspace/libsinsp/cgroup_limits.cpp | ||
8 | @@ -9,7 +9,7 @@ namespace { | ||
9 | // This reports extremely large values (e.g. almost-but-not-quite 9EiB as set by k8s) as unlimited. | ||
10 | // Note: we use the same maximum value for cpu shares/quotas as well; the typical values are much lower | ||
11 | // and so should never exceed CGROUP_VAL_MAX either | ||
12 | -constexpr const int64_t CGROUP_VAL_MAX = (1UL << 42u) - 1; | ||
13 | +constexpr const int64_t CGROUP_VAL_MAX = (1ULL << 42u) - 1; | ||
14 | |||
15 | /** | ||
16 | * \brief Read a single int64_t value from cgroupfs | ||
diff --git a/meta-oe/recipes-extended/sysdig/sysdig_git.bb b/meta-oe/recipes-extended/sysdig/sysdig_git.bb index 4f58281f9f..ce1a4245ba 100644 --- a/meta-oe/recipes-extended/sysdig/sysdig_git.bb +++ b/meta-oe/recipes-extended/sysdig/sysdig_git.bb | |||
@@ -3,39 +3,49 @@ DESCRIPTION = "Sysdig is open source, system-level exploration: capture \ | |||
3 | system state and activity from a running Linux instance, then save, \ | 3 | system state and activity from a running Linux instance, then save, \ |
4 | filter and analyze." | 4 | filter and analyze." |
5 | HOMEPAGE = "http://www.sysdig.org/" | 5 | HOMEPAGE = "http://www.sysdig.org/" |
6 | LICENSE = "GPLv2" | 6 | LICENSE = "Apache-2.0 & (MIT | GPL-2.0)" |
7 | LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" | 7 | LIC_FILES_CHKSUM = "file://COPYING;md5=f8fee3d59797546cffab04f3b88b2d44" |
8 | 8 | ||
9 | inherit cmake pkgconfig | 9 | inherit cmake pkgconfig |
10 | 10 | ||
11 | OECMAKE_GENERATOR = "Unix Makefiles" | 11 | #OECMAKE_GENERATOR = "Unix Makefiles" |
12 | JIT ?= "jit" | ||
13 | JIT_mipsarchn32 = "" | ||
14 | JIT_mipsarchn64 = "" | ||
15 | JIT_aarch64 = "" | ||
12 | 16 | ||
13 | DEPENDS = "luajit zlib ncurses" | 17 | DEPENDS += "lua${JIT} zlib c-ares grpc-native grpc curl ncurses jsoncpp tbb jq openssl elfutils protobuf protobuf-native jq-native" |
14 | RDEPENDS_${PN} = "bash" | 18 | RDEPENDS_${PN} = "bash" |
15 | 19 | ||
16 | SRC_URI = "git://github.com/draios/sysdig.git;branch=master \ | 20 | SRC_URI = "git://github.com/draios/sysdig.git;branch=dev \ |
17 | file://0001-libsinsp-Port-to-build-with-lua-5.2.patch \ | 21 | file://0001-fix-build-with-LuaJIT-2.1-betas.patch \ |
18 | file://0001-Fix-build-with-musl-backtrace-APIs-are-glibc-specifi.patch \ | 22 | file://0001-Fix-build-with-musl-backtrace-APIs-are-glibc-specifi.patch \ |
23 | file://fix-uint64-const.patch \ | ||
19 | " | 24 | " |
20 | SRCREV = "85d16f33a82a17f87ccdbc088749271c71d87013" | 25 | # v0.26.4 |
21 | PV = "0.1.102+git${SRCPV}" | 26 | SRCREV = "9fa0d129668fdabf256446be4be35838888052d9" |
27 | PV = "0.26.5" | ||
22 | 28 | ||
23 | S = "${WORKDIR}/git" | 29 | S = "${WORKDIR}/git" |
24 | 30 | ||
25 | DIR_ETC="/etc" | 31 | EXTRA_OECMAKE = "\ |
26 | EXTRA_OECMAKE = ' -DUSE_BUNDLED_LUAJIT="OFF" \ | 32 | -DBUILD_DRIVER=OFF \ |
27 | -DUSE_BUNDLED_ZLIB="OFF" \ | 33 | -DUSE_BUNDLED_DEPS=OFF \ |
28 | -DBUILD_DRIVER="OFF" \ | 34 | -DUSE_BUNDLED_B64=ON \ |
29 | -DUSE_BUNDLED_NCURSES="OFF" \ | 35 | -DCREATE_TEST_TARGETS=OFF \ |
30 | -DDIR_ETC="${DIR_ETC}" \ | 36 | -DDIR_ETC=${sysconfdir} \ |
31 | ' | 37 | -DLUA_INCLUDE_DIR=${STAGING_INCDIR}/luajit-2.1 \ |
38 | -DLUA_LIBRARY=libluajit-5.1.so \ | ||
39 | " | ||
32 | 40 | ||
33 | FILES_${PN} += " \ | 41 | FILES_${PN} += " \ |
34 | ${DIR_ETC}/* \ | 42 | ${DIR_ETC}/* \ |
35 | ${datadir}/zsh/* \ | 43 | ${datadir}/zsh/* \ |
36 | ${prefix}/src/* \ | 44 | ${prefix}/src/* \ |
37 | " | 45 | " |
38 | 46 | # Use getaddrinfo_a is a GNU extension in libsinsp | |
39 | # luajit not supported on Aarch64 | 47 | # It should be fixed in sysdig, until then disable |
40 | COMPATIBLE_HOST = "^(?!aarch64).*" | 48 | # on musl |
41 | 49 | # Something like this https://code.videolan.org/ePirat/vlc/-/commit/01fd9fe4c7f6c5558f7345f38abf0152e17853ab is needed to fix it | |
50 | COMPATIBLE_HOST_libc-musl = "null" | ||
51 | COMPATIBLE_HOST_mips = "null" | ||