From f35fe992298b244064c841e8407ac7d96dce1be5 Mon Sep 17 00:00:00 2001
From: xietangxin <xietangxin@huawei.com>
Date: Tue, 30 Apr 2024 12:11:59 +0800
Subject: [PATCH] fix compile warnings when disable KAFKA_CHANNEL

---
 build/install.sh    | 11 ++++++++---
 src/common/event.c  | 19 +++++++++++--------
 src/egress/egress.c |  1 +
 3 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/build/install.sh b/build/install.sh
index 55d911d..acde443 100755
--- a/build/install.sh
+++ b/build/install.sh
@@ -22,7 +22,10 @@ function __create_btf_cache()
     for file in $(find ${BTF_DIR} -name "*"${ARCH}"*.btf.tar.xz") ; do
         tar -xf $file
     done
-    find ./ -name "*.btf" | xargs mv -t ${BTF_CACHE}
+
+    for file in $(find ./ -name "*.btf") ; do
+        mv $file -t  ${BTF_CACHE}
+    done
 }
 
 function __delete_btf_cache()
@@ -169,8 +172,10 @@ function install_shared_lib()
         cp ${SHARED_LIB} ${GOPHER_SHARED_LIB_DIR}
     done
 
-    echo "install lib:" ${JVM_ATTACH_BIN}
-    cp ${JVM_ATTACH_BIN} ${GOPHER_SHARED_LIB_DIR}
+    if ! [[ $EXTEND_PROBES =~ "l7probe" ]] || ! [[ $EXTEND_PROBES =~ "stackprobe" ]] || ! [[ $EXTEND_PROBES =~ "jvm.probe" ]] ; then
+        echo "install lib:" ${JVM_ATTACH_BIN}
+        cp ${JVM_ATTACH_BIN} ${GOPHER_SHARED_LIB_DIR}
+    fi
 }
 
 function install_extend_probes()
diff --git a/src/common/event.c b/src/common/event.c
index a53dc2f..2694c2d 100644
--- a/src/common/event.c
+++ b/src/common/event.c
@@ -26,11 +26,15 @@
 #include "nprobe_fprintf.h"
 #endif
 
-static struct evt_ts_hash_t *g_evt_head = NULL;
+
 static unsigned int g_evt_period = 600;
 // static EventsConfig *g_evt_conf;
 // static char g_lang_type[MAX_EVT_GRP_NAME_LEN] = "zh_CN";
 
+
+#ifdef ENABLE_REPORT_EVENT
+static struct evt_ts_hash_t *g_evt_head = NULL;
+
 static void hash_clear_older_evt(time_t cur_time);
 static unsigned int hash_count_evt(void);
 static int is_evt_need_report(const char *entityId, time_t cur_time);
@@ -61,7 +65,6 @@ static struct evt_sec_s secs[EVT_SEC_MAX] = {
     {21,              "FATAL"}
 };
 
-#ifdef ENABLE_REPORT_EVENT
 #define __EVT_BODY_LEN  512 // same as MAX_IMDB_METRIC_VAL_LEN
 void report_logs(const struct event_info_s* evt, enum evt_sec_e sec, const char * fmt, ...)
 {
@@ -143,12 +146,6 @@ void report_logs(const struct event_info_s* evt, enum evt_sec_e sec, const char
 #endif
     return;
 }
-#else
-void report_logs(const struct event_info_s* evt, enum evt_sec_e sec, const char * fmt, ...)
-{
-    return;
-}
-#endif
 
 void emit_otel_log(struct otel_log *ol)
 {
@@ -243,6 +240,12 @@ static int is_evt_need_report(const char *entityId, time_t cur_time)
     }
     return 0;
 }
+#else
+void report_logs(const struct event_info_s* evt, enum evt_sec_e sec, const char * fmt, ...)
+{
+    return;
+}
+#endif
 
 void init_event_mgr(unsigned int time_out)
 {
diff --git a/src/egress/egress.c b/src/egress/egress.c
index 3af7396..6081b34 100644
--- a/src/egress/egress.c
+++ b/src/egress/egress.c
@@ -21,6 +21,7 @@
 #include <sys/epoll.h>
 
 #include "base.h"
+#include "common.h"
 #include "egress.h"
 
 EgressMgr *EgressMgrCreate(void)
-- 
2.28.0.windows.1

