From d19ffe7459560ff6ae53ea2faee05ae1143ccd26 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 22 Jul 2026 09:06:54 +0000 Subject: [PATCH] sysdig: pin Curses to target sysroot so chisel uses LuaJIT lua.h 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 --- .../recipes-extended/sysdig/sysdig_0.39.0.bb | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/meta-oe/recipes-extended/sysdig/sysdig_0.39.0.bb b/meta-oe/recipes-extended/sysdig/sysdig_0.39.0.bb index a59e7d296c..b9bf8ba90f 100644 --- a/meta-oe/recipes-extended/sysdig/sysdig_0.39.0.bb +++ b/meta-oe/recipes-extended/sysdig/sysdig_0.39.0.bb @@ -60,17 +60,24 @@ EXTRA_OECMAKE = "\ -DUSE_BUNDLED_JSONCPP=OFF \ -DBUILD_SYSDIG_MODERN_BPF=OFF \ -DCREATE_TEST_TARGETS=OFF \ + -DCURSES_INCLUDE_DIR=${STAGING_INCDIR} \ + -DCURSES_LIBRARIES=${STAGING_LIBDIR}/libncurses.so\;${STAGING_LIBDIR}/libform.so \ " -# sysdig's chisel code does #include "lua.h". The recipe-sysroot also carries -# stock Lua headers (openembedded-core lua installs lua.h into ${includedir}), -# which are ABI-incompatible with the LuaJIT library sysdig links against: 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 provides. -# sysdig's luajit.cmake only honours LUA_INCLUDE_DIR in its stock-Lua fallback, -# not when it finds LuaJIT, and the LuaJIT include dir does not win the search -# order, so lua.h resolves to the stock header and the link fails. Put the -# LuaJIT include dir first so its lua.h is used and matches the linked library. +# sysdig's chisel code does #include "lua.h", but the only lua.h it must ever +# resolve to is LuaJIT's (it links libluajit-5.1.so). The native sysroot also +# ships a stock Lua header (lua-native pulls lua.h into +# recipe-sysroot-native/usr/include), and in Lua >= 5.4.4 luaL_openlibs is a +# macro for luaL_openselectedlibs while lua_setglobal/getglobal/pcallk are real +# symbols, none of which LuaJIT provides -- so compiling chisel against it makes +# the link fail with undefined Lua symbols. +# +# That native include dir leaks onto the target compile line because sysdig's +# ncurses.cmake runs find_package(Curses), which resolves CURSES_INCLUDE_DIR to +# the native sysroot (native also carries ncurses.h/form.h) and then does +# include_directories(${CURSES_INCLUDE_DIR}), placing it ahead of the LuaJIT +# include dir. Pin Curses to the target sysroot so the native dir (and its stray +# lua.h) never reaches the target build; lua.h then resolves via LUAJIT_INCLUDE. #Add include dir to find driver_config.h CXXFLAGS:append = " -I${STAGING_INCDIR}/luajit-2.1 -I${WORKDIR}/driver_Make/driver/src" CFLAGS:append = " -I${STAGING_INCDIR}/luajit-2.1 -I${WORKDIR}/driver_Make/driver/src"