From dbf7652e198cca7655b9767d2efd61ae21872800 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Mon, 20 Jul 2026 16:30:28 +0100 Subject: [PATCH] fix(telemetry): link in-memory exporter archive by path, not component The opentelemetry-cpp::exporter_in_memory component declares no libs (the Conan recipe ships libopentelemetry_exporter_in_memory.a but does not associate it with the component), so linking that target put nothing on the link line and xrpl_tests still failed with an undefined reference to InMemorySpanExporterFactory::Create. Locate the archive with find_library (HINTS the OTel package lib dir) and link it by path, ahead of the umbrella so its undefined SDK references resolve. Verified: the archive now appears on the generated link line and xrpl_tests links + the SpanGuardScope tests pass. Supersedes the no-op component-target link in the prior commit. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/tests/libxrpl/CMakeLists.txt | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/tests/libxrpl/CMakeLists.txt b/src/tests/libxrpl/CMakeLists.txt index 6481cc73a0..52eebfae9d 100644 --- a/src/tests/libxrpl/CMakeLists.txt +++ b/src/tests/libxrpl/CMakeLists.txt @@ -67,15 +67,23 @@ endif() # The telemetry test module exercises SpanGuard/Telemetry, which link against # the OpenTelemetry SDK when the telemetry build option is enabled. if(telemetry) - # The umbrella opentelemetry-cpp target does NOT include the in-memory - # exporter in its link set, so link that component explicitly: the - # SpanGuardScope tests drive an InMemorySpanExporter to read exported - # spans. Test-only -- production code never uses this exporter. + # The SpanGuardScope tests drive an InMemorySpanExporter to read exported + # spans (test-only; production never uses it). The Conan package ships + # libopentelemetry_exporter_in_memory.a but declares the component with no + # libs, so neither the umbrella target nor opentelemetry-cpp::exporter_in_memory + # puts the archive on the link line. Locate it by path and link it BEFORE + # the umbrella so its undefined SDK references resolve against the umbrella. + find_library( + OTEL_IN_MEMORY_EXPORTER_LIB + NAMES opentelemetry_exporter_in_memory + HINTS "${opentelemetry-cpp_PACKAGE_FOLDER_RELEASE}/lib" + REQUIRED + ) target_link_libraries( xrpl_tests PRIVATE + "${OTEL_IN_MEMORY_EXPORTER_LIB}" opentelemetry-cpp::opentelemetry-cpp - opentelemetry-cpp::exporter_in_memory ) endif()