From 50336c9af003ff2f9c631830218e444206dfa5d0 Mon Sep 17 00:00:00 2001 From: David Bensoussan Date: Wed, 14 Jun 2023 10:55:23 +0200 Subject: [PATCH] conf: use a custom flb-2.1.3 fork to not require root (#235) Signed-off-by: David Bensoussan --- fluent_bit_plugins/src/c/in_ros2.c | 4 +- fluent_bit_vendor/CMakeLists.txt | 167 +++++++++++++++++++++-------- 2 files changed, 122 insertions(+), 49 deletions(-) diff --git a/fluent_bit_plugins/src/c/in_ros2.c b/fluent_bit_plugins/src/c/in_ros2.c index c76933db..cf8b7dd6 100644 --- a/fluent_bit_plugins/src/c/in_ros2.c +++ b/fluent_bit_plugins/src/c/in_ros2.c @@ -125,9 +125,9 @@ void data_callback(const void* msgin) char* pack; ctx->buf = msg->data.data; ctx->buf_len = msg->data.capacity; - flb_debug("buf_len: %ld, buf: '%s'", ctx->buf_len, ctx->buf); + flb_debug("buf_len: %d, buf: '%s'", ctx->buf_len, ctx->buf); - int ret = flb_pack_json(ctx->buf, ctx->buf_len, &pack, &pack_size, &root_type); + int ret = flb_pack_json(ctx->buf, ctx->buf_len, &pack, &pack_size, &root_type, NULL); if (ret == FLB_ERR_JSON_PART) { flb_warn("Data incomplete, waiting for more..."); diff --git a/fluent_bit_vendor/CMakeLists.txt b/fluent_bit_vendor/CMakeLists.txt index 4a8a1794..4df1b2d8 100644 --- a/fluent_bit_vendor/CMakeLists.txt +++ b/fluent_bit_vendor/CMakeLists.txt @@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.5) project(fluent_bit_vendor) find_package(ament_cmake REQUIRED) -find_package(dc_interfaces REQUIRED) set(cmake_commands) set(cmake_configure_args -Wno-dev) @@ -56,10 +55,10 @@ else() endif() set(fluent_bit_external_project_dir ${CMAKE_CURRENT_BINARY_DIR}/fluent_bit) include(ExternalProject) -set(fluent_bit_version "1ab360f79c73627a0789551287c074aa2016bf26") -# message(${CMAKE_CURRENT_LIST_DIR}) +set(fluent_bit_version "fix-2.1.3") + ExternalProject_Add(fluent_bit_src - GIT_REPOSITORY https://github.com/fluent/fluent-bit + GIT_REPOSITORY https://github.com/minipada/fluent-bit GIT_TAG ${fluent_bit_version} GIT_CONFIG advice.detachedHead=false PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_LIST_DIR}/mpack.patch @@ -76,59 +75,133 @@ ExternalProject_Add(fluent_bit_src -DFLB_OUT_PGSQL=On -DFLB_SHARED_LIB=On -DFLB_PROXY_GO=On + -DSYSTEMD_UNITDIR=${fluent_bit_external_project_dir}/install/system ${cmake_configure_args} ) externalproject_get_property(fluent_bit_src INSTALL_DIR) -set(fluent_bit_INCLUDE_DIR "${INSTALL_DIR}/../fluent_bit/install/include") +set(fluent_bit_INCLUDE_DIR "${INSTALL_DIR}/../fluent_bit/install/include/") set(fluent_bit_LIB_DIR "${INSTALL_DIR}/../fluent_bit/install/lib/fluent-bit") -set(FB_SRC_LIB_INCLUDE_DIR "${INSTALL_DIR}/src/fluent_bit_src/lib") - -set(ares_INCLUDE_FILES - "${FB_SRC_LIB_INCLUDE_DIR}/c-ares-1.18.1/include/ares.h" - "${FB_SRC_LIB_INCLUDE_DIR}/c-ares-1.18.1/include/ares_build.h" - "${FB_SRC_LIB_INCLUDE_DIR}/c-ares-1.18.1/include/ares_rules.h" - "${FB_SRC_LIB_INCLUDE_DIR}/c-ares-1.18.1/include/ares_version.h" -) -set(cfl_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/cfl/include/cfl") -set(cmetrics_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/cmetrics/include/cmetrics") -set(ctraces_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/ctraces/include/ctraces") -set(jsmn_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/jsmn") -set(mkcore_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/monkey/include/monkey/mk_core") -set(mpack_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/mpack-amalgamation-1.1/src/mpack") -set(msgpack_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/msgpack-c/include/msgpack") -set(msgpack_INCLUDE_FILES - "${FB_SRC_LIB_INCLUDE_DIR}/msgpack-c/include/msgpack.h" -) -set(prometheus_remote_write_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/cmetrics/include/prometheus_remote_write") -set(xxhash_INCLUDE_FILES - "${FB_SRC_LIB_INCLUDE_DIR}/cfl/lib/xxhash/xxhash.h" - "${FB_SRC_LIB_INCLUDE_DIR}/cfl/lib/xxhash/xxh3.h" -) +set(FB_SRC_LIB_INCLUDE_DIR "${INSTALL_DIR}/src/fluent_bit_src/lib") +set(FB_SRC_INCLUDE_DIR "${INSTALL_DIR}/src/fluent_bit_src/include/fluent-bit") -install(DIRECTORY ${fluent_bit_INCLUDE_DIR}/ DESTINATION include) -install(FILES ${ares_INCLUDE_FILES} DESTINATION include) -install(DIRECTORY ${cfl_INCLUDE_DIR}/ DESTINATION include/cfl) -install(DIRECTORY ${cmetrics_INCLUDE_DIR}/ DESTINATION include/cmetrics) -install(DIRECTORY ${ctraces_INCLUDE_DIR}/ DESTINATION include/ctraces) -install(DIRECTORY ${jsmn_INCLUDE_DIR}/ DESTINATION include/jsmn) -install(DIRECTORY ${mkcore_INCLUDE_DIR}/ DESTINATION include/mk_core) -install(DIRECTORY ${mpack_INCLUDE_DIR}/ DESTINATION include/mpack) -install(DIRECTORY ${msgpack_INCLUDE_DIR}/ DESTINATION include/msgpack) -install(FILES ${msgpack_INCLUDE_FILES} DESTINATION include) -install(DIRECTORY ${prometheus_remote_write_INCLUDE_DIR}/ DESTINATION include/prometheus_remote_write) -install(FILES ${xxhash_INCLUDE_FILES}/ DESTINATION include) +set(ares_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/c-ares-1.19.0/include/") +set(cfl_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/cfl/include/cfl/") +set(config_format_INCLUDE_DIR "${FB_SRC_INCLUDE_DIR}/config_format/") +set(cmetrics_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/cmetrics/include/cmetrics/") +set(ctraces_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/ctraces/include/ctraces/") +set(jsmn_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/jsmn/") +set(mkcore_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/monkey/include/monkey/mk_core/") +set(mpack_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/mpack-amalgamation-1.1/src/mpack/") +set(msgpack_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/msgpack-c/include/msgpack/") +set(msgpack_INCLUDE_FILES "${FB_SRC_LIB_INCLUDE_DIR}/msgpack-c/include/msgpack.h") +set(prometheus_remote_write_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/cmetrics/include/prometheus_remote_write/") +set(xxhash_INCLUDE_DIR "${FB_SRC_LIB_INCLUDE_DIR}/cfl/lib/xxhash/") -install(FILES ${fluent_bit_LIB_DIR}/libfluent-bit.so DESTINATION lib) -install(FILES ${INSTALL_DIR}/src/fluent_bit_src/library/libmsgpack-c-static.a DESTINATION lib) -install(FILES ${INSTALL_DIR}/src/fluent_bit_src/library/libfluent-bit.a DESTINATION lib) - -install(DIRECTORY cmake DESTINATION share/${PROJECT_NAME}) +install( + DIRECTORY + ${fluent_bit_INCLUDE_DIR} + ${ares_INCLUDE_DIR} + DESTINATION + include +) install( - DIRECTORY ${INSTALL_DIR}/src/fluent_bit_src/cmake - DESTINATION share/${PROJECT_NAME} + DIRECTORY + ${cfl_INCLUDE_DIR} + DESTINATION + include/cfl +) +install( + DIRECTORY + ${config_format_INCLUDE_DIR} + DESTINATION + include/config_format +) +install( + DIRECTORY + ${cmetrics_INCLUDE_DIR} + DESTINATION + include/cmetrics +) +install( + DIRECTORY + ${ctraces_INCLUDE_DIR} + DESTINATION + include/ctraces +) +install( + DIRECTORY + ${jsmn_INCLUDE_DIR} + DESTINATION + include/jsmn +) +install( + DIRECTORY + ${mkcore_INCLUDE_DIR} + DESTINATION + include/mk_core +) +install( + DIRECTORY + ${mpack_INCLUDE_DIR} + DESTINATION + include/mpack +) +install( + DIRECTORY + ${msgpack_INCLUDE_DIR} + DESTINATION + include/msgpack +) +install( + FILES + ${msgpack_INCLUDE_FILES} + DESTINATION + include +) +install( + DIRECTORY + ${prometheus_remote_write_INCLUDE_DIR} + DESTINATION + include/prometheus_remote_write +) +install( + DIRECTORY + ${xxhash_INCLUDE_DIR} + DESTINATION + include +) +install( + FILES + ${fluent_bit_LIB_DIR}/libfluent-bit.so + DESTINATION + lib +) +install( + FILES + ${INSTALL_DIR}/src/fluent_bit_src/library/libmsgpack-c-static.a + DESTINATION + lib +) +install( + FILES + ${INSTALL_DIR}/src/fluent_bit_src/library/libfluent-bit.a + DESTINATION + lib +) +install( + DIRECTORY + cmake + DESTINATION + share/${PROJECT_NAME} +) +install( + DIRECTORY + ${INSTALL_DIR}/src/fluent_bit_src/cmake + DESTINATION + share/${PROJECT_NAME} ) ament_export_include_directories(include)