do_compile could fail with many: fatal error: 'libsinsp/sinsp.h' file not found fatal error: 'sinsp.h' file not found fatal error: 'libscap/strl.h' file not found
across all userspace/sysdig objects, even though the headers exist in the fetched falcosecurity-libs source. The add_library de-duplication patch guarded the libscap/libsinsp modules with a HAVE_LIBSCAP/HAVE_LIBSINSP flag set as CACHE INTERNAL. Because that value persists in CMakeCache, ninja's build-time regeneration rule (cmake --regenerate-during-build, which fires whenever a CMake input's timestamp changes between do_configure and do_compile) re-runs cmake with the flag already true. The libscap/libsinsp add_subdirectory() is then skipped, dropping the scap/sinsp targets and their PUBLIC include directories, so target_link_libraries(sysdig sinsp) degrades to a bare -lsinsp with no header propagation. Guard on target existence (if(NOT TARGET scap|sinsp)) instead. Target existence is global within a single cmake run -- so it still prevents the duplicate add_library -- but is not persisted across runs, so the modules are correctly re-processed on every regeneration. Verified: a build-time cmake regeneration now keeps the libsinsp/libscap object rules and falcosecurity-libs include paths in build.ninja, and a full clean build plus a post-touch recompile both succeed. Signed-off-by: Khem Raj <[email protected]> --- ...-duplicate-operations-of-add_library.patch | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/meta-oe/recipes-extended/sysdig/sysdig/0001-Avoid-duplicate-operations-of-add_library.patch b/meta-oe/recipes-extended/sysdig/sysdig/0001-Avoid-duplicate-operations-of-add_library.patch index b8ca7dd38b..ec9ca46269 100644 --- a/meta-oe/recipes-extended/sysdig/sysdig/0001-Avoid-duplicate-operations-of-add_library.patch +++ b/meta-oe/recipes-extended/sysdig/sysdig/0001-Avoid-duplicate-operations-of-add_library.patch @@ -9,36 +9,48 @@ To fix following configure error | add_library cannot create target "scap_error" because another target with | the same name already exists. The existing target is a static library +Guard the libscap/libsinsp modules on the existence of the "scap"/"sinsp" +targets rather than on a cached HAVE_LIBSCAP/HAVE_LIBSINSP flag. A cached +flag persists into the CMakeCache, so when Ninja re-runs CMake during the +build (the "cmake --regenerate-during-build" RERUN rule fires whenever a +CMake input's timestamp changes) the guard is already true and the +add_subdirectory() for libscap/libsinsp is skipped. That drops the scap/ +sinsp targets and their PUBLIC include directories, and the userspace/ +sysdig targets then fail to compile with "'libsinsp/sinsp.h' file not +found". Target existence is global within a single CMake run (so it still +prevents the duplicate add_library) but is not persisted across runs, so +the modules are re-processed on every regeneration. + Upstream-Status: Inappropriate [oe-specific] Signed-off-by: Liu Yiding <[email protected]> --- - cmake/modules/libscap.cmake | 2 +- - cmake/modules/libsinsp.cmake | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) + cmake/modules/libscap.cmake | 3 +-- + cmake/modules/libsinsp.cmake | 3 +-- + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cmake/modules/libscap.cmake b/cmake/modules/libscap.cmake -index b41b12ff3..1753598e9 100644 --- a/cmake/modules/libscap.cmake +++ b/cmake/modules/libscap.cmake -@@ -14,7 +14,7 @@ +@@ -13,8 +13,7 @@ + # the License. # - if(NOT HAVE_LIBSCAP) +-if(NOT HAVE_LIBSCAP) - set(HAVE_LIBSCAP On) -+ set(HAVE_LIBSCAP On CACHE INTERNAL "Flag to indicate libscap has been processed") ++if(NOT TARGET scap) if(NOT LIBS_DIR) get_filename_component(LIBS_DIR ${CMAKE_CURRENT_LIST_DIR}/../.. ABSOLUTE) diff --git a/cmake/modules/libsinsp.cmake b/cmake/modules/libsinsp.cmake -index ff336e27f..0fdd2d4a9 100644 --- a/cmake/modules/libsinsp.cmake +++ b/cmake/modules/libsinsp.cmake -@@ -14,7 +14,7 @@ +@@ -13,8 +13,7 @@ + # the License. # - if(NOT HAVE_LIBSINSP) +-if(NOT HAVE_LIBSINSP) - set(HAVE_LIBSINSP On) -+ set(HAVE_LIBSINSP On CACHE INTERNAL "Flag to indicate libsinsp has been processed") ++if(NOT TARGET sinsp) if(NOT LIBS_DIR) get_filename_component(LIBS_DIR ${CMAKE_CURRENT_LIST_DIR}/../.. ABSOLUTE)
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#128144): https://lists.openembedded.org/g/openembedded-devel/message/128144 Mute This Topic: https://lists.openembedded.org/mt/120242462/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
