Skip to content

No system package for njson #1879

Description

@dadav

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: falcosecurity/falco#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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions