0001-plugins-kafka-fix-cmake-cross-compile-error.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. From f32c4e909ec4a4872c2c5fc186f27d1f7e4e8c2a Mon Sep 17 00:00:00 2001
  2. From: Thomas Devoogdt <thomas@devoogdt.com>
  3. Date: Sat, 16 Nov 2024 19:46:28 +0100
  4. Subject: [PATCH] plugins: kafka: fix cmake cross compile error
  5. KAFKA_INCLUDEDIR is not set if FLB_PREFER_SYSTEM_LIB_KAFKA is not used,
  6. when cross-compiling, it just translates to -I/librdkafka, which is not allowed.
  7. Fix this by only including KAFKA_INCLUDEDIR if really set.
  8. x86_64-linux-gcc: ERROR: unsafe header/library path used in cross-compilation: '-I/librdkafka'
  9. Upstream: https://github.com/fluent/fluent-bit/pull/9600
  10. Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
  11. ---
  12. plugins/in_kafka/CMakeLists.txt | 4 +++-
  13. plugins/out_kafka/CMakeLists.txt | 4 +++-
  14. 2 files changed, 6 insertions(+), 2 deletions(-)
  15. diff --git a/plugins/in_kafka/CMakeLists.txt b/plugins/in_kafka/CMakeLists.txt
  16. index ede0831f9..02e2dc786 100644
  17. --- a/plugins/in_kafka/CMakeLists.txt
  18. +++ b/plugins/in_kafka/CMakeLists.txt
  19. @@ -3,5 +3,7 @@ set(src
  20. )
  21. FLB_PLUGIN(in_kafka "${src}" ${KAFKA_LIBRARIES})
  22. -target_include_directories(flb-plugin-in_kafka PUBLIC ${KAFKA_INCLUDEDIR}/librdkafka)
  23. +if(DEFINED KAFKA_INCLUDEDIR)
  24. + target_include_directories(flb-plugin-in_kafka PUBLIC ${KAFKA_INCLUDEDIR}/librdkafka)
  25. +endif()
  26. target_link_libraries(flb-plugin-in_kafka -lpthread)
  27. diff --git a/plugins/out_kafka/CMakeLists.txt b/plugins/out_kafka/CMakeLists.txt
  28. index 01c96529b..54b14fc2a 100644
  29. --- a/plugins/out_kafka/CMakeLists.txt
  30. +++ b/plugins/out_kafka/CMakeLists.txt
  31. @@ -5,5 +5,7 @@ set(src
  32. kafka.c)
  33. FLB_PLUGIN(out_kafka "${src}" ${KAFKA_LIBRARIES})
  34. -target_include_directories(flb-plugin-out_kafka PUBLIC ${KAFKA_INCLUDEDIR}/librdkafka)
  35. +if(DEFINED KAFKA_INCLUDEDIR)
  36. + target_include_directories(flb-plugin-out_kafka PUBLIC ${KAFKA_INCLUDEDIR}/librdkafka)
  37. +endif()
  38. target_link_libraries(flb-plugin-out_kafka -lpthread)
  39. --
  40. 2.43.0