From e9f3afa1ee1282d9825293ee2cc1db85f40b6141 Mon Sep 17 00:00:00 2001 From: jiaqizho Date: Tue, 30 Jun 2026 11:21:29 +0800 Subject: [PATCH] fix: Undefined symbols in milvus::tracer::AutoSpan::AutoSpan build with milvus failed with stack: ``` Undefined symbols for architecture arm64: "milvus::tracer::AutoSpan::AutoSpan(std::__1::basic_string, std::__1::allocator> const&, std::__1::shared_ptr const&, bool)", referenced from: milvus::index::BitmapIndex::In(unsigned long, bool const*) in BitmapIndex.cpp.o milvus::index::BitmapIndex::IsNull() in BitmapIndex.cpp.o milvus::index::BitmapIndex::IsNotNull() in BitmapIndex.cpp.o milvus::index::BitmapIndex::NotIn(unsigned long, bool const*) in BitmapIndex.cpp.o milvus::index::BitmapIndex::Reverse_Lookup(unsigned long) const in BitmapIndex.cpp.o milvus::index::BitmapIndex::In(unsigned long, signed char const*) in BitmapIndex.cpp.o milvus::index::BitmapIndex::IsNull() in BitmapIndex.cpp.o ... ld: symbol(s) not found for architecture arm64 clang++: error: linker command failed with exit code 1 (use -v to see invocation) ``` Pre-defined autospan will got this error Signed-off-by: jiaqizho --- include/common/Tracer.h | 6 ++++-- test/TracerTest.cpp | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/common/Tracer.h b/include/common/Tracer.h index 81c9266..c46ae05 100644 --- a/include/common/Tracer.h +++ b/include/common/Tracer.h @@ -21,10 +21,12 @@ #include "opentelemetry/trace/span_id.h" #include "opentelemetry/trace/trace_id.h" -namespace opentelemetry::trace { +OPENTELEMETRY_BEGIN_NAMESPACE +namespace trace { class Span; class Tracer; -} // namespace opentelemetry::trace +} // namespace trace +OPENTELEMETRY_END_NAMESPACE #define TRACE_SERVICE_SEGCORE "segcore" diff --git a/test/TracerTest.cpp b/test/TracerTest.cpp index 93743b0..4a442a4 100644 --- a/test/TracerTest.cpp +++ b/test/TracerTest.cpp @@ -57,6 +57,12 @@ TEST(Tracer, Span) { delete[] ctx->spanID; } +TEST(Tracer, AutoSpanParentConstructorUsesHeaderDeclaredSpanType) { + std::shared_ptr parent; + AutoSpan span("header_abi_parent", parent, false); + ASSERT_NE(span.GetSpan(), nullptr); +} + TEST(Tracer, OwnedTraceSnapshotCopiesBytes) { uint8_t trace_id[16]{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10};