chisel does #include "lua.h" and links libluajit-5.1.so, but the link
failed with undefined Lua symbols (luaL_openselectedlibs, lua_setglobal,
lua_getglobal, lua_pcallk). Those come from the stock Lua >= 5.4 header,
not LuaJIT.
The stray stock lua.h reaches the target compile line via ncurses.cmake:
find_package(Curses) resolves CURSES_INCLUDE_DIR to the native sysroot
(recipe-sysroot-native/usr/include, which also carries ncurses.h/form.h
and, dragged in by lua-native, lua.h), then include_directories() places
that dir ahead of the LuaJIT include dir. The prior CXXFLAGS -I workaround
could not win because CMake orders target include_directories before
CMAKE_CXX_FLAGS.
Pin CURSES_INCLUDE_DIR/CURSES_LIBRARIES to the target sysroot so the native
include dir never leaks into the target build; lua.h then resolves through
LUAJIT_INCLUDE and matches the linked library.
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
csysdig fails to link when stock Lua is also present in the sysroot:
ld.lld: error: undefined symbol: luaL_openselectedlibs
>>> referenced by chisel.cpp:1190
ld.lld: error: undefined symbol: lua_pcallk
ld.lld: error: undefined symbol: lua_setglobal
sysdig's chisel code does #include "lua.h" and links against LuaJIT
(lua${JIT}), but the recipe-sysroot also carries stock Lua headers
(openembedded-core lua installs lua.h into ${includedir}). Those headers
win the include search over ${includedir}/luajit-2.1, so the chisel
objects are compiled against stock Lua while the binary links
libluajit-5.1.so. In Lua >= 5.4.4 luaL_openlibs is a macro for
luaL_openselectedlibs and lua_setglobal/lua_pcallk are real symbols,
none of which LuaJIT (a Lua 5.1 ABI) provides, hence the undefined
references. -DLUA_INCLUDE_DIR does not help: sysdig's luajit.cmake only
consults it in its stock-Lua fallback, not when it finds LuaJIT.
Prepend ${STAGING_INCDIR}/luajit-2.1 to CFLAGS/CXXFLAGS. These land in
CMAKE_CXX_FLAGS, which precede CMake's generated -I includes, so LuaJIT's
lua.h is found first and matches the linked library.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
Upgrade sysdig to solve build failure after upgrading valijson to 1.1.0.
1.Changelog
https://github.com/draios/sysdig/releases/tag/0.39.0
2.Update 0001-cmake-Pass-PROBE_NAME-via-CFLAGS.patch for 0.39.0
3.Remove following patches as merged upstream
0001-Add-cstdint-for-uintXX_t-types.patch
0001-libsinsp-fix-build-with-gcc-15.patch
4.Add 0001-Avoid-duplicate-operations-of-add_library.patch to fix do_configure errors
-- Existing strlcat found, will *not* use local definition
CMake Error at falcosecurity-libs/userspace/libscap/CMakeLists.txt:64 (add_library):
add_library cannot create target "scap_error" because another target with
the same name already exists. The existing target is a static library
5.Add CMAKE option -DBUILD_SYSDIG_MODERN_BPF=OFF to fix bpf header file not found issue
sysdig/0.39.0/recipe-sysroot/usr/include/bits/syscall.h:23:10: fatal error: 'bits/syscall-32.h' file not found
| 23 | #include <bits/syscall-32.h>
6.Add do_configure:prepend() function and CFLAGS/CXXFLAGS to fix header file not found issue
sysdig/0.39.0/sources/sysdig-0.39.0/falcosecurity-libs/userspace/libscap/engine/kmod/scap_kmod.c:30:10: fatal error: driver_config.h: No such file or directory
| 30 | #include <driver_config.h>
7.Add do_compile:append() function to fix do_package QA Issue
Signed-off-by: Liu Yiding <liuyd.fnst@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>