fix: Linking issues for anomaly_detection-t TAP test

- Add special build rule in Makefile for anomaly_detection-t that includes:
  - $(OBJ) for global variables (GloVars, GloGATH)
  - -Wl,--allow-multiple-definition to allow test's main() to override ProxySQL's
  - ClickHouse client libraries (libclickhouse-cpp-lib.a, libzstdstatic.a, liblz4.a)
  - SQLite rembed library (libsqlite_rembed.a)
  - -lscram -lusual for PostgreSQL SCRAM support
- Add stub function SQLite3_Server_session_handler required by SQLite3_Server.cpp

Resolves compilation errors for anomaly_detection-t test.
pull/5310/head
Rene Cannao 1 month ago
parent a831670a79
commit 0dc3531744

@ -168,6 +168,9 @@ sh-%:
cp $(patsubst sh-%,%,$@) $(patsubst sh-%.sh,%,$@)
chmod +x $(patsubst sh-%.sh,%,$@)
anomaly_detection-t: anomaly_detection-t.cpp $(TAP_LDIR)/libtap.so
$(CXX) -DEXCLUDE_TRACKING_VARAIABLES $< ../tap/SQLite3_Server.cpp -I$(CLICKHOUSE_CPP_IDIR) $(IDIRS) $(LDIRS) -L$(CLICKHOUSE_CPP_LDIR) -L$(LZ4_LDIR) $(OPT) $(OBJ) $(MYLIBSJEMALLOC) $(MYLIBS) $(STATIC_LIBS) $(CLICKHOUSE_CPP_LDIR)/libclickhouse-cpp-lib.a $(CLICKHOUSE_CPP_PATH)/contrib/zstd/zstd/libzstdstatic.a $(LZ4_LDIR)/liblz4.a $(SQLITE3_LDIR)/../libsqlite_rembed.a -lscram -lusual -Wl,--allow-multiple-definition -o $@
%-t: %-t.cpp $(TAP_LDIR)/libtap.so
$(CXX) $< $(IDIRS) $(LDIRS) $(OPT) $(MYLIBS) $(STATIC_LIBS) -o $@

@ -50,6 +50,17 @@ MYSQL* g_admin = NULL;
class AI_Features_Manager;
extern AI_Features_Manager *GloAI;
// Forward declarations
class MySQL_Session;
typedef struct _PtrSize_t PtrSize_t;
// Stub for SQLite3_Server_session_handler - required by SQLite3_Server.cpp
// This test uses admin MySQL connection, so this is just a placeholder
void SQLite3_Server_session_handler(MySQL_Session* sess, void* _pa, PtrSize_t* pkt) {
// This is a stub - the actual test uses MySQL admin connection
// The SQLite3_Server.cpp sets this as a handler but we don't use it
}
// ============================================================================
// Helper Functions
// ============================================================================

Loading…
Cancel
Save