sysdig icon indicating copy to clipboard operation
sysdig copied to clipboard

No system package for njson

Open dadav opened this issue 3 years ago • 1 comments

Hello ppl. from the internet,

I'm running archlinux with kernel 5.18.3-arch1-1 and couldn't build sysdig with my system libraries because there is no system package for njson. Using USE_BUNDLED_DEPS=ON also doesn't work because of some GSASL ERROR, see here: https://github.com/falcosecurity/falco/issues/2040

I used the following commands

mkdir build
cd build
cmake .. -DBUILD_BPF=ON -DUSE_BUNDLED_DEPS=OFF
make -j12 sysdig

To make this thing work, I need to modify the cmake/modules/nlohmann-json.cmake file to basically exclude this library from the USE_BUNDLED_DEPS=OFF option...like this:


if(NOT USE_BUNDLED_DEPS)
  find_path(NJSON_INCLUDE_DIR NAMES nlohmann/json.hpp)
  if(NJSON_INCLUDE_DIR)
    message(STATUS "Found njson: include: ${NJSON_INCLUDE_DIR}")
  else()
    message(FATAL_ERROR "Couldn't find system njson")
  endif()
else()
  set(NJSON_SRC "${PROJECT_BINARY_DIR}/njson-prefix/src/njson")
  message(STATUS "Using bundled nlohmann-json in '${NJSON_SRC}'")
  set(NJSON_INCLUDE_DIR "${NJSON_SRC}/single_include")
  ExternalProject_Add(
    njson
    URL "https://github.com/nlohmann/json/archive/v3.3.0.tar.gz"
    URL_HASH "SHA256=2fd1d207b4669a7843296c41d3b6ac5b23d00dec48dba507ba051d14564aa801"
    CONFIGURE_COMMAND ""
    BUILD_COMMAND ""
    INSTALL_COMMAND "")
endif()

to

  set(NJSON_SRC "${PROJECT_BINARY_DIR}/njson-prefix/src/njson")
  message(STATUS "Using bundled nlohmann-json in '${NJSON_SRC}'")
  set(NJSON_INCLUDE_DIR "${NJSON_SRC}/single_include")
  ExternalProject_Add(
    njson
    URL "https://github.com/nlohmann/json/archive/v3.3.0.tar.gz"
    URL_HASH "SHA256=2fd1d207b4669a7843296c41d3b6ac5b23d00dec48dba507ba051d14564aa801"
    CONFIGURE_COMMAND ""
    BUILD_COMMAND ""
    INSTALL_COMMAND "")

Proposal

Add a cmake option to exclude njson from the USE_BUNDLED_DEPS=OFF effects.

What do you think?

dadav avatar Jun 11 '22 08:06 dadav

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Feb 22 '23 08:02 github-actions[bot]