Files
Khem Raj ebde9459c8 sysdig: Fix intermittent missing libsinsp/libscap headers on rebuild
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 <khem.raj@oss.qualcomm.com>
2026-07-12 17:39:43 -07:00
..