opentelemetry-cpp: [BUILD] Link failure using x64 Windows DLL

Environment Using main branch x64 Windows 10 Microsoft Visual Studio Enterprise 2022 (64-bit) - 17.6.2

Steps to reproduce

  • Clone repo
  • Build with cmake using the following options (cmake does not recognize OPENTELEMETRY_BUILD_DLL option by itself so you have to add it manually): image
  • Build the generated visual studio solution for Debug x64
  • Include the following code in a program and copy the dll next to the exe:
#define OPENTELEMETRY_BUILD_IMPORT_DLL

#include "opentelemetry/exporters/otlp/otlp_http_exporter_factory.h"
#include "opentelemetry/exporters/otlp/otlp_http_exporter_options.h"
#include "opentelemetry/sdk/common/global_log_handler.h"
#include "opentelemetry/sdk/trace/processor.h"
#include "opentelemetry/sdk/trace/simple_processor_factory.h"
#include "opentelemetry/sdk/trace/tracer_provider_factory.h"
#include "opentelemetry/trace/provider.h"

namespace trace = opentelemetry::trace;
namespace trace_sdk = opentelemetry::sdk::trace;
namespace otlp = opentelemetry::exporter::otlp;

...

opentelemetry::exporter::otlp::OtlpHttpExporterOptions opts;

// Create OTLP exporter instance
auto exporter = otlp::OtlpHttpExporterFactory::Create(opts);
auto processor = trace_sdk::SimpleSpanProcessorFactory::Create(std::move(exporter));
std::shared_ptr<opentelemetry::trace::TracerProvider> provider = trace_sdk::TracerProviderFactory::Create(std::move(processor));
// Set the global trace provider
trace::Provider::SetTracerProvider(provider);
  • Define the macros in the preprocessor of the project where the program is _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS HAVE_CPP_STDLIB
  • Build the program.

What is the expected behavior? Successful compilation. from the docs: NOTE: the current build produces a single DLL which includes API, SDK and exporters. This MAY change in future.

What is the actual behavior? Error during compilation

2>xxx.obj : error LNK2019: unresolved external symbol “class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl opentelemetry::v1::exporter::otlp::GetOtlpDefaultHttpTracesEndpoint(void)” (?GetOtlpDefaultHttpTracesEndpoint@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function “class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl opentelemetry::v1::exporter::otlp::GetOtlpDefaultHttpEndpoint(void)” (?GetOtlpDefaultHttpEndpoint@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) 2>xxx.obj : error LNK2019: unresolved external symbol “class std::chrono::duration<__int64,struct std::ratio<1,10000000> > __cdecl opentelemetry::v1::exporter::otlp::GetOtlpDefaultTracesTimeout(void)” (?GetOtlpDefaultTracesTimeout@otlp@exporter@v1@opentelemetry@@YA?AV?$duration@_JU?$ratio@$00$0JIJGIA@@std@@@chrono@std@@XZ) referenced in function “class std::chrono::duration<__int64,struct std::ratio<1,10000000> > __cdecl opentelemetry::v1::exporter::otlp::GetOtlpDefaultTimeout(void)” (?GetOtlpDefaultTimeout@otlp@exporter@v1@opentelemetry@@YA?AV?$duration@_JU?$ratio@$00$0JIJGIA@@std@@@chrono@std@@XZ) 2>xxx.obj : error LNK2019: unresolved external symbol “class std::multimap<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct opentelemetry::v1::exporter::otlp::cmp_ic,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > __cdecl opentelemetry::v1::exporter::otlp::GetOtlpDefaultTracesHeaders(void)” (?GetOtlpDefaultTracesHeaders@otlp@exporter@v1@opentelemetry@@YA?AV?$multimap@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@Ucmp_ic@otlp@exporter@v1@opentelemetry@@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@@2@@std@@XZ) referenced in function “class std::multimap<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct opentelemetry::v1::exporter::otlp::cmp_ic,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > __cdecl opentelemetry::v1::exporter::otlp::GetOtlpDefaultHeaders(void)” (?GetOtlpDefaultHeaders@otlp@exporter@v1@opentelemetry@@YA?AV?$multimap@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@Ucmp_ic@otlp@exporter@v1@opentelemetry@@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@@2@@std@@XZ) 2>C:\xxx\x64\Debug\xxx.exe : fatal error LNK1120: 3 unresolved externals

In dependency walker these are the symbols in the DLL:

1 (0x0001), (0x), int public: static class std::shared_ptr<class opentelemetry::v1::trace::TraceState> __cdecl opentelemetry::v1::trace::TraceState::GetDefault(void)'::2’::$TSS0, 0x001ea974, Microsoft

2 (0x0002), (0x), TSS0<`template-parameter-2’,opentelemetry::v1::trace::Provider::tLock,signed char,unsigned char &,void const opentelemetry::v1::common::SpinLockMutex::&,int, ?? &>, 0x001eab04, Microsoft

3 (0x0003), (0x), TSS0<`template-parameter-2’,opentelemetry::v1::trace::Provider::tProvider,signed char,unsigned char &,void const std::shared_ptr<class opentelemetry::v1::trace::TracerProvider>::&,int, ?? &>, 0x001eaafc, Microsoft

4 (0x0004), (0x), TSS0<`template-parameter-2’,opentelemetry::v1::context::RuntimeContext::tStorage,signed char,unsigned char &,void const std::shared_ptr<class opentelemetry::v1::context::RuntimeContextStorage>::&,int, ?? &>, 0x001ea924, Microsoft

5 (0x0005), (0x), int private: static bool __cdecl opentelemetry::v1::trace::TraceState::IsValidKeyRegEx(class std::basic_string_view<char,struct std::char_traits<char> >)'::2’::$TSS0, 0x001ea9ec, Microsoft

6 (0x0006), (0x), int private: static bool __cdecl opentelemetry::v1::trace::TraceState::IsValidValueRegEx(class std::basic_string_view<char,struct std::char_traits<char> >)'::2’::$TSS0, 0x001eaacc, Microsoft

7 (0x0007), (0x), int public: virtual class std::shared_ptr<class opentelemetry::v1::trace::Span> __cdecl opentelemetry::v1::trace::NoopTracer::StartSpan(class std::basic_string_view<char,struct std::char_traits<char> >,class opentelemetry::v1::common::KeyValueIterable const & __ptr64,class opentelemetry::v1::trace::SpanContextKeyValueIterable const & __ptr64,struct opentelemetry::v1::trace::StartSpanOptions const & __ptr64) __ptr64'::2’::$TSS0, 0x001eaae4, Microsoft

8 (0x0008), (0x), int private: static bool __cdecl opentelemetry::v1::trace::TraceState::IsValidKeyRegEx(class std::basic_string_view<char,struct std::char_traits<char> >)'::2’::$TSS1, 0x001eaa5c, Microsoft

9 (0x0009), (0x), protected: __cdecl std::enable_shared_from_this<class opentelemetry::v1::trace::NoopTracer>::enable_shared_from_this<class opentelemetry::v1::trace::NoopTracer>(class std::enable_shared_from_this<class opentelemetry::v1::trace::NoopTracer> const & __ptr64) __ptr64, 0x00001cf8, Microsoft

10 (0x000a), (0x), protected: __cdecl std::enable_shared_from_this<class opentelemetry::v1::trace::NoopTracer>::enable_shared_from_this<class opentelemetry::v1::trace::NoopTracer>(void) __ptr64, 0x00004aac, Microsoft

11 (0x000b), (0x), public: __cdecl opentelemetry::v1::trace::NoopSpan::NoopSpan(class std::shared_ptr<class opentelemetry::v1::trace::Tracer> const & __ptr64) __ptr64, 0x0000ae20, Microsoft

12 (0x000c), (0x), public: __cdecl opentelemetry::v1::trace::NoopSpan::NoopSpan(class std::shared_ptr<class opentelemetry::v1::trace::Tracer> const & __ptr64,class std::unique_ptr<class opentelemetry::v1::trace::SpanContext,struct std::default_delete<class opentelemetry::v1::trace::SpanContext> >) __ptr64, 0x00006226, Microsoft

13 (0x000d), (0x), public: __cdecl opentelemetry::v1::trace::NoopTracer::NoopTracer(class opentelemetry::v1::trace::NoopTracer && __ptr64) __ptr64, 0x000030c1, Microsoft

14 (0x000e), (0x), public: __cdecl opentelemetry::v1::trace::NoopTracer::NoopTracer(class opentelemetry::v1::trace::NoopTracer const & __ptr64) __ptr64, 0x0000a8ee, Microsoft

15 (0x000f), (0x), public: __cdecl opentelemetry::v1::trace::NoopTracer::NoopTracer(void) __ptr64, 0x00008a0d, Microsoft

16 (0x0010), (0x), public: __cdecl opentelemetry::v1::trace::NoopTracerProvider::NoopTracerProvider(class opentelemetry::v1::trace::NoopTracerProvider && __ptr64) __ptr64, 0x00004782, Microsoft

17 (0x0011), (0x), public: __cdecl opentelemetry::v1::trace::NoopTracerProvider::NoopTracerProvider(class opentelemetry::v1::trace::NoopTracerProvider const & __ptr64) __ptr64, 0x00001b68, Microsoft

18 (0x0012), (0x), public: __cdecl opentelemetry::v1::trace::NoopTracerProvider::NoopTracerProvider(void) __ptr64, 0x00006992, Microsoft

19 (0x0013), (0x), public: __cdecl opentelemetry::v1::context::RuntimeContextStorage::RuntimeContextStorage(class opentelemetry::v1::context::RuntimeContextStorage const & __ptr64) __ptr64, 0x000079af, Microsoft

20 (0x0014), (0x), public: __cdecl opentelemetry::v1::context::RuntimeContextStorage::RuntimeContextStorage(void) __ptr64, 0x0000b186, Microsoft

21 (0x0015), (0x), private: __cdecl opentelemetry::v1::trace::TraceState::TraceState(void) __ptr64, 0x000052a9, Microsoft

22 (0x0016), (0x), private: __cdecl opentelemetry::v1::trace::TraceState::TraceState(unsigned __int64) __ptr64, 0x00002cde, Microsoft

23 (0x0017), (0x), public: __cdecl opentelemetry::v1::trace::TraceState::TraceState(class opentelemetry::v1::trace::TraceState && __ptr64) __ptr64, 0x00008d28, Microsoft

24 (0x0018), (0x), public: __cdecl opentelemetry::v1::trace::TracerProvider::TracerProvider(class opentelemetry::v1::trace::TracerProvider const & __ptr64) __ptr64, 0x000065dc, Microsoft

25 (0x0019), (0x), public: __cdecl opentelemetry::v1::trace::TracerProvider::TracerProvider(void) __ptr64, 0x00009fa2, Microsoft

26 (0x001a), (0x), protected: __cdecl std::enable_shared_from_this<class opentelemetry::v1::trace::NoopTracer>::~enable_shared_from_this<class opentelemetry::v1::trace::NoopTracer>(void) __ptr64, 0x00006d2f, Microsoft

27 (0x001b), (0x), public: virtual __cdecl opentelemetry::v1::trace::NoopSpan::~NoopSpan(void) __ptr64, 0x000015cd, Microsoft

28 (0x001c), (0x), public: virtual __cdecl opentelemetry::v1::trace::NoopTracer::~NoopTracer(void) __ptr64, 0x00003643, Microsoft

29 (0x001d), (0x), public: virtual __cdecl opentelemetry::v1::trace::NoopTracerProvider::~NoopTracerProvider(void) __ptr64, 0x0000a9c5, Microsoft

30 (0x001e), (0x), public: virtual __cdecl opentelemetry::v1::context::RuntimeContextStorage::~RuntimeContextStorage(void) __ptr64, 0x00005cfe, Microsoft

31 (0x001f), (0x), public: __cdecl opentelemetry::v1::trace::TraceState::~TraceState(void) __ptr64, 0x000053a8, Microsoft

32 (0x0020), (0x), public: virtual __cdecl opentelemetry::v1::trace::TracerProvider::~TracerProvider(void) __ptr64, 0x00006280, Microsoft

33 (0x0021), (0x), protected: class std::enable_shared_from_this<class opentelemetry::v1::trace::NoopTracer> & __ptr64 __cdecl std::enable_shared_from_this<class opentelemetry::v1::trace::NoopTracer>::operator=(class std::enable_shared_from_this<class opentelemetry::v1::trace::NoopTracer> const & __ptr64) __ptr64, 0x0000b550, Microsoft

34 (0x0022), (0x), public: class opentelemetry::v1::trace::NoopTracer & __ptr64 __cdecl opentelemetry::v1::trace::NoopTracer::operator=(class opentelemetry::v1::trace::NoopTracer && __ptr64) __ptr64, 0x00003c24, Microsoft

35 (0x0023), (0x), public: class opentelemetry::v1::trace::NoopTracer & __ptr64 __cdecl opentelemetry::v1::trace::NoopTracer::operator= (class opentelemetry::v1::trace::NoopTracer const & __ptr64) __ptr64, 0x0000330f, Microsoft

36 (0x0024), (0x), public: class opentelemetry::v1::trace::NoopTracerProvider & __ptr64 __cdecl opentelemetry::v1::trace::NoopTracerProvider::operator=(class opentelemetry::v1::trace::NoopTracerProvider && __ptr64) __ptr64, 0x00009813, Microsoft

37 (0x0025), (0x), public: class opentelemetry::v1::trace::NoopTracerProvider & __ptr64 __cdecl opentelemetry::v1::trace::NoopTracerProvider::operator=(class opentelemetry::v1::trace::NoopTracerProvider const & __ptr64) __ptr64, 0x00004994, Microsoft

38 (0x0026), (0x), public: class opentelemetry::v1::trace::Provider & __ptr64 __cdecl opentelemetry::v1::trace::Provider::operator=(class opentelemetry::v1::trace::Provider && __ptr64) __ptr64, 0x0000a6b9, Microsoft

39 (0x0027), (0x), public: class opentelemetry::v1::trace::Provider & __ptr64 __cdecl opentelemetry::v1::trace::Provider::operator=(class opentelemetry::v1::trace::Provider const & __ptr64) __ptr64, 0x000085e4, Microsoft

40 (0x0028), (0x), public: class opentelemetry::v1::context::RuntimeContext & __ptr64 __cdecl opentelemetry::v1::context::RuntimeContext::operator=(class opentelemetry::v1::context::RuntimeContext && __ptr64) __ptr64, 0x000058b7, Microsoft

41 (0x0029), (0x), public: class opentelemetry::v1::context::RuntimeContext & __ptr64 __cdecl opentelemetry::v1::context::RuntimeContext::operator=(class opentelemetry::v1::context::RuntimeContext const & __ptr64) __ptr64, 0x000091dd, Microsoft

42 (0x002a), (0x), public: class opentelemetry::v1::context::RuntimeContextStorage & __ptr64 __cdecl opentelemetry::v1::context::RuntimeContextStorage::operator=(class opentelemetry::v1::context::RuntimeContextStorage const & __ptr64) __ptr64, 0x0000a40c, Microsoft

43 (0x002b), (0x), public: class opentelemetry::v1::trace::TraceState & __ptr64 __cdecl opentelemetry::v1::trace::TraceState::operator=(class opentelemetry::v1::trace::TraceState && __ptr64) __ptr64, 0x00008837, Microsoft

44 (0x002c), (0x), public: class opentelemetry::v1::trace::TracerProvider & __ptr64 __cdecl opentelemetry::v1::trace::TracerProvider::operator=(class opentelemetry::v1::trace::TracerProvider const & __ptr64) __ptr64, 0x00003170, Microsoft

45 (0x002d), (0x), const opentelemetry::v1::trace::NoopSpan::`vftable’, 0x0016bdc8, Microsoft

46 (0x002e), (0x), const opentelemetry::v1::trace::NoopTracer::`vftable’, 0x0016be40, Microsoft

47 (0x002f), (0x), const opentelemetry::v1::trace::NoopTracerProvider::`vftable’, 0x0016be70, Microsoft

48 (0x0030), (0x), const opentelemetry::v1::context::RuntimeContextStorage::`vftable’, 0x0016b9a8, Microsoft

49 (0x0031), (0x), const opentelemetry::v1::trace::TracerProvider::`vftable’, 0x0016bda8, Microsoft

50 (0x0032), (0x), public: virtual void __cdecl opentelemetry::v1::trace::NoopSpan::AddEvent(class std::basic_string_view<char,struct std::char_traits<char> >) __ptr64, 0x00009aed, Microsoft

51 (0x0033), (0x), public: virtual void __cdecl opentelemetry::v1::trace::NoopSpan::AddEvent(class std::basic_string_view<char,struct std::char_traits<char> >,class opentelemetry::v1::common::KeyValueIterable const & __ptr64) __ptr64, 0x000094b2, Microsoft

52 (0x0034), (0x), public: virtual void __cdecl opentelemetry::v1::trace::NoopSpan::AddEvent(class std::basic_string_view<char,struct std::char_traits<char> >,class opentelemetry::v1::common::SystemTimestamp) __ptr64, 0x000074f5, Microsoft

53 (0x0035), (0x), public: virtual void __cdecl opentelemetry::v1::trace::NoopSpan::AddEvent(class std::basic_string_view<char,struct std::char_traits<char> >,class opentelemetry::v1::common::SystemTimestamp,class opentelemetry::v1::common::KeyValueIterable const & __ptr64) __ptr64, 0x00003d46, Microsoft

54 (0x0036), (0x), public: static class std::unique_ptr<class opentelemetry::v1::context::Token,struct std::default_delete<class opentelemetry::v1::context::Token> > __cdecl opentelemetry::v1::context::RuntimeContext::Attach(class opentelemetry::v1::context::Context const & __ptr64), 0x0000933b, Microsoft

55 (0x0037), (0x), public: virtual void __cdecl opentelemetry::v1::trace::NoopTracer::CloseWithMicroseconds(unsigned __int64) __ptr64, 0x00004188, Microsoft

56 (0x0038), (0x), public: static class std::unique_ptr<class opentelemetry::v1::sdk::trace::SpanExporter,struct std::default_delete<class opentelemetry::v1::sdk::trace::SpanExporter> > __cdecl opentelemetry::v1::exporter::trace::OStreamSpanExporterFactory::Create(void), 0x00004fcf, Microsoft

57 (0x0039), (0x), public: static class std::unique_ptr<class opentelemetry::v1::sdk::trace::SpanExporter,struct std::default_delete<class opentelemetry::v1::sdk::trace::SpanExporter> > __cdecl opentelemetry::v1::exporter::otlp::OtlpHttpExporterFactory::Create(struct opentelemetry::v1::exporter::otlp::OtlpHttpExporterOptions const & __ptr64), 0x00006e60, Microsoft

58 (0x003a), (0x), public: static class std::unique_ptr<class opentelemetry::v1::sdk::trace::SpanProcessor,struct std::default_delete<class opentelemetry::v1::sdk::trace::SpanProcessor> > __cdecl opentelemetry::v1::sdk::trace::SimpleSpanProcessorFactory::Create(class std::unique_ptr<class opentelemetry::v1::sdk::trace::SpanExporter,struct std::default_delete<class opentelemetry::v1::sdk::trace::SpanExporter> > && __ptr64), 0x000088f0, Microsoft

59 (0x003b), (0x), public: static class std::unique_ptr<class opentelemetry::v1::trace::TracerProvider,struct std::default_delete<class opentelemetry::v1::trace::TracerProvider> > __cdecl opentelemetry::v1::sdk::trace::TracerProviderFactory::Create(class std::unique_ptr<class opentelemetry::v1::sdk::trace::SpanProcessor,struct std::default_delete<class opentelemetry::v1::sdk::trace::SpanProcessor> >), 0x000019d3, Microsoft

60 (0x003c), (0x), protected: class std::unique_ptr<class opentelemetry::v1::context::Token,struct std::default_delete<class opentelemetry::v1::context::Token> > __cdecl opentelemetry::v1::context::RuntimeContextStorage::CreateToken(class opentelemetry::v1::context::Context const & __ptr64) __ptr64, 0x000043ef, Microsoft

61 (0x003d), (0x), public: class std::shared_ptr<class opentelemetry::v1::trace::TraceState> __cdecl opentelemetry::v1::trace::TraceState::Delete(class std::basic_string_view<char,struct std::char_traits<char> > const & __ptr64) __ptr64, 0x0000777f, Microsoft

62 (0x003e), (0x), public: static bool __cdecl opentelemetry::v1::context::RuntimeContext::Detach(class opentelemetry::v1::context::Token & __ptr64), 0x00001e10, Microsoft

63 (0x003f), (0x), public: bool __cdecl opentelemetry::v1::trace::TraceState::Empty(void)const __ptr64, 0x00009e62, Microsoft

64 (0x0040), (0x), public: virtual void __cdecl opentelemetry::v1::trace::NoopSpan::End(struct opentelemetry::v1::trace::EndSpanOptions const & __ptr64) __ptr64, 0x00009d68, Microsoft

65 (0x0041), (0x), public: virtual void __cdecl opentelemetry::v1::trace::NoopTracer::ForceFlushWithMicroseconds(unsigned __int64) __ptr64, 0x00001753, Microsoft

66 (0x0042), (0x), public: static class std::shared_ptr<class opentelemetry::v1::trace::TraceState> __cdecl opentelemetry::v1::trace::TraceState::FromHeader(class std::basic_string_view<char,struct std::char_traits<char> >), 0x000035b7, Microsoft

67 (0x0043), (0x), public: bool __cdecl opentelemetry::v1::trace::TraceState::Get(class std::basic_string_view<char,struct std::char_traits<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __ptr64)const __ptr64, 0x000022b6, Microsoft

68 (0x0044), (0x), public: bool __cdecl opentelemetry::v1::trace::TraceState::GetAllEntries(class opentelemetry::v1::nostd::function_ref<bool __cdecl(class std::basic_string_view<char,struct std::char_traits<char> >,class std::basic_string_view<char,struct std::char_traits<char> >)>)const __ptr64, 0x00007f2c, Microsoft

69 (0x0045), (0x), public: static class std::shared_ptr<class opentelemetry::v1::context::RuntimeContextStorage const > __cdecl opentelemetry::v1::context::RuntimeContext::GetConstRuntimeContextStorage(void), 0x00006c67, Microsoft

70 (0x0046), (0x), public: virtual class opentelemetry::v1::trace::SpanContext __cdecl opentelemetry::v1::trace::NoopSpan::GetContext(void)const __ptr64, 0x000077ac, Microsoft

71 (0x0047), (0x), public: static class opentelemetry::v1::context::Context __cdecl opentelemetry::v1::context::RuntimeContext::GetCurrent(void), 0x00006ff0, Microsoft

72 (0x0048), (0x), public: static class std::shared_ptr<class opentelemetry::v1::trace::TraceState> __cdecl opentelemetry::v1::trace::TraceState::GetDefault(void), 0x0000a817, Microsoft

73 (0x0049), (0x), private: static class opentelemetry::v1::common::SpinLockMutex & __ptr64 __cdecl opentelemetry::v1::trace::Provider::GetLock(void), 0x000094ad, Microsoft

74 (0x004a), (0x), private: static class std::shared_ptr<class opentelemetry::v1::trace::TracerProvider> & __ptr64 __cdecl opentelemetry::v1::trace::Provider::GetProvider(void), 0x00001c94, Microsoft

75 (0x004b), (0x), private: static class std::shared_ptr<class opentelemetry::v1::context::RuntimeContextStorage> __cdecl opentelemetry::v1::context::RuntimeContext::GetRuntimeContextStorage(void), 0x00004e49, Microsoft

76 (0x004c), (0x), private: static class std::shared_ptr<class opentelemetry::v1::context::RuntimeContextStorage> & __ptr64 __cdecl opentelemetry::v1::context::RuntimeContext::GetStorage(void), 0x0000b36b, Microsoft

77 (0x004d), (0x), public: virtual class std::shared_ptr<class opentelemetry::v1::trace::Tracer> __cdecl opentelemetry::v1::trace::NoopTracerProvider::GetTracer(class std::basic_string_view<char,struct std::char_traits<char> >,class std::basic_string_view<char,struct std::char_traits<char> >,class std::basic_string_view<char,struct std::char_traits<char> >) __ptr64, 0x00004511, Microsoft

78 (0x004e), (0x), public: static class std::shared_ptr<class opentelemetry::v1::trace::TracerProvider> __cdecl opentelemetry::v1::trace::Provider::GetTracerProvider(void), 0x00005ac4, Microsoft

79 (0x004f), (0x), public: static class std::variant<struct std::monostate,bool,__int64,unsigned __int64,double,class std::shared_ptr<class opentelemetry::v1::trace::Span>,class std::shared_ptr<class opentelemetry::v1::trace::SpanContext>,class std::shared_ptr<class opentelemetry::v1::baggage::Baggage> > __cdecl opentelemetry::v1::context::RuntimeContext::GetValue(class std::basic_string_view<char,struct std::char_traits<char> >,class opentelemetry::v1::context::Context * __ptr64), 0x00001280, Microsoft

80 (0x0050), (0x), private: static bool __cdecl opentelemetry::v1::trace::TraceState::IsLowerCaseAlphaOrDigit(char), 0x00008738, Microsoft

81 (0x0051), (0x), public: virtual bool __cdecl opentelemetry::v1::trace::NoopSpan::IsRecording(void)const __ptr64, 0x00009d1d, Microsoft

82 (0x0052), (0x), public: static bool __cdecl opentelemetry::v1::trace::TraceState::IsValidKey(class std::basic_string_view<char,struct std::char_traits<char> >), 0x0000426e, Microsoft

83 (0x0053), (0x), private: static bool __cdecl opentelemetry::v1::trace::TraceState::IsValidKeyNonRegEx(class std::basic_string_view<char,struct std::char_traits<char> >), 0x000074e1, Microsoft

84 (0x0054), (0x), private: static bool __cdecl opentelemetry::v1::trace::TraceState::IsValidKeyRegEx(class std::basic_string_view<char,struct std::char_traits<char> >), 0x000056b9, Microsoft

85 (0x0055), (0x), public: static bool __cdecl opentelemetry::v1::trace::TraceState::IsValidValue(class std::basic_string_view<char,struct std::char_traits<char> >), 0x0000772a, Microsoft

86 (0x0056), (0x), private: static bool __cdecl opentelemetry::v1::trace::TraceState::IsValidValueNonRegEx(class std::basic_string_view<char,struct std::char_traits<char> >), 0x00004a7f, Microsoft

87 (0x0057), (0x), private: static bool __cdecl opentelemetry::v1::trace::TraceState::IsValidValueRegEx(class std::basic_string_view<char,struct std::char_traits<char> >), 0x0000614a, Microsoft

88 (0x0058), (0x), public: class std::shared_ptr<class opentelemetry::v1::trace::TraceState> __cdecl opentelemetry::v1::trace::TraceState::Set(class std::basic_string_view<char,struct std::char_traits<char> > const & __ptr64,class std::basic_string_view<char,struct std::char_traits<char> > const & __ptr64) __ptr64, 0x00009d40, Microsoft

89 (0x0059), (0x), public: virtual void __cdecl opentelemetry::v1::trace::NoopSpan::SetAttribute(class std::basic_string_view<char,struct std::char_traits<char> >,class std::variant<bool,int,__int64,unsigned int,double,char const * __ptr64,class std::basic_string_view<char,struct std::char_traits<char> >,class std::span<bool const ,-1>,class std::span<int const ,-1>,class std::span<__int64 const ,-1>,class std::span<unsigned int const ,-1>,class std::span<double const ,-1>,class std::span<class std::basic_string_view<char,struct std::char_traits<char> > const ,-1>,unsigned __int64,class std::span<unsigned __int64 const ,-1>,class std::span<unsigned char const ,-1> > const & __ptr64) __ptr64, 0x0000a6d2, Microsoft

90 (0x005a), (0x), public: static void __cdecl opentelemetry::v1::context::RuntimeContext::SetRuntimeContextStorage(class std::shared_ptr<class opentelemetry::v1::context::RuntimeContextStorage>), 0x000020e5, Microsoft

91 (0x005b), (0x), public: virtual void __cdecl opentelemetry::v1::trace::NoopSpan::SetStatus(enum opentelemetry::v1::trace::StatusCode,class std::basic_string_view<char,struct std::char_traits<char> >) __ptr64, 0x0000687f, Microsoft

92 (0x005c), (0x), public: static void __cdecl opentelemetry::v1::trace::Provider::SetTracerProvider(class std::shared_ptr<class opentelemetry::v1::trace::TracerProvider>), 0x000064fb, Microsoft

93 (0x005d), (0x), public: static class opentelemetry::v1::context::Context __cdecl opentelemetry::v1::context::RuntimeContext::SetValue(class std::basic_string_view<char,struct std::char_traits<char> >,class std::variant<struct std::monostate,bool,__int64,unsigned __int64,double,class std::shared_ptr<class opentelemetry::v1::trace::Span>,class std::shared_ptr<class opentelemetry::v1::trace::SpanContext>,class std::shared_ptr<class opentelemetry::v1::baggage::Baggage> > const & __ptr64,class opentelemetry::v1::context::Context * __ptr64), 0x00005867, Microsoft

94 (0x005e), (0x), public: virtual class std::shared_ptr<class opentelemetry::v1::trace::Span> __cdecl opentelemetry::v1::trace::NoopTracer::StartSpan(class std::basic_string_view<char,struct std::char_traits<char> >,class opentelemetry::v1::common::KeyValueIterable const & __ptr64,class opentelemetry::v1::trace::SpanContextKeyValueIterable const & __ptr64,struct opentelemetry::v1::trace::StartSpanOptions const & __ptr64) __ptr64, 0x00005dc1, Microsoft

95 (0x005f), (0x), public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl opentelemetry::v1::trace::TraceState::ToHeader(void)const __ptr64, 0x000017d5, Microsoft

96 (0x0060), (0x), private: static class std::basic_string_view<char,struct std::char_traits<char> > __cdecl opentelemetry::v1::trace::TraceState::TrimString(class std::basic_string_view<char,struct std::char_traits<char> >,unsigned __int64,unsigned __int64), 0x0000528b, Microsoft

97 (0x0061), (0x), public: virtual void __cdecl opentelemetry::v1::trace::NoopSpan::UpdateName(class std::basic_string_view<char,struct std::char_traits<char> >) __ptr64, 0x00005880, Microsoft

98 (0x0062), (0x), class std::shared_ptr<class opentelemetry::v1::context::RuntimeContextStorage> private: static class std::shared_ptr<class opentelemetry::v1::context::RuntimeContextStorage> & __ptr64 __cdecl opentelemetry::v1::context::RuntimeContext::GetStorage(void)'::2’::context, 0x001ea910, Microsoft

99 (0x0063), (0x), public: static int const opentelemetry::v1::trace::TraceState::kKeyMaxSize, 0x00166f64, Microsoft

100 (0x0064), (0x), public: static char const opentelemetry::v1::trace::TraceState::kKeyValueSeparator, 0x00166f70, Microsoft

101 (0x0065), (0x), public: static int const opentelemetry::v1::trace::TraceState::kMaxKeyValuePairs, 0x00166f6c, Microsoft

102 (0x0066), (0x), public: static char const opentelemetry::v1::trace::TraceState::kMembersSeparator, 0x00166f71, Microsoft

103 (0x0067), (0x), public: static int const opentelemetry::v1::trace::TraceState::kValueMaxSize, 0x00166f68, Microsoft

104 (0x0068), (0x), class opentelemetry::v1::common::SpinLockMutex private: static class opentelemetry::v1::common::SpinLockMutex & __ptr64 __cdecl opentelemetry::v1::trace::Provider::GetLock(void)'::2’::lock, 0x001eab00, Microsoft

105 (0x0069), (0x), class std::shared_ptr<class opentelemetry::v1::trace::Span> public: virtual class std::shared_ptr<class opentelemetry::v1::trace::Span> __cdecl opentelemetry::v1::trace::NoopTracer::StartSpan(class std::basic_string_view<char,struct std::char_traits<char> >,class opentelemetry::v1::common::KeyValueIterable const & __ptr64,class opentelemetry::v1::trace::SpanContextKeyValueIterable const & __ptr64,struct opentelemetry::v1::trace::StartSpanOptions const & __ptr64) __ptr64'::2’::noop_span, 0x001eaad0, Microsoft

106 (0x006a), (0x), class std::shared_ptr<class opentelemetry::v1::trace::TracerProvider> private: static class std::shared_ptr<class opentelemetry::v1::trace::TracerProvider> & __ptr64 __cdecl opentelemetry::v1::trace::Provider::GetProvider(void)'::2’::provider, 0x001eaae8, Microsoft

107 (0x006b), (0x), class std::basic_regex<char,class std::regex_traits<char> > private: static bool __cdecl opentelemetry::v1::trace::TraceState::IsValidKeyRegEx(class std::basic_string_view<char,struct std::char_traits<char> >)'::2’::reg_key, 0x001ea980, Microsoft

108 (0x006c), (0x), class std::basic_regex<char,class std::regex_traits<char> > private: static bool __cdecl opentelemetry::v1::trace::TraceState::IsValidKeyRegEx(class std::basic_string_view<char,struct std::char_traits<char> >)'::2’::reg_key_multitenant, 0x001ea9f0, Microsoft

109 (0x006d), (0x), class std::basic_regex<char,class std::regex_traits<char> > private: static bool __cdecl opentelemetry::v1::trace::TraceState::IsValidValueRegEx(class std::basic_string_view<char,struct std::char_traits<char> >)'::2’::reg_value, 0x001eaa60, Microsoft

110 (0x006e), (0x), public: class std::shared_ptr<class opentelemetry::v1::trace::NoopTracer> __cdecl std::enable_shared_from_this<class opentelemetry::v1::trace::NoopTracer>::shared_from_this(void) __ptr64, 0x00003b39, Microsoft

111 (0x006f), (0x), public: class std::shared_ptr<class opentelemetry::v1::trace::NoopTracer const > __cdecl std::enable_shared_from_this<class opentelemetry::v1::trace::NoopTracer>::shared_from_this(void)const __ptr64, 0x00003440, Microsoft

112 (0x0070), (0x), class std::shared_ptr<class opentelemetry::v1::trace::TraceState> public: static class std::shared_ptr<class opentelemetry::v1::trace::TraceState> __cdecl opentelemetry::v1::trace::TraceState::GetDefault(void)'::2’::ts, 0x001ea960, Microsoft

113 (0x0071), (0x), public: class std::weak_ptr<class opentelemetry::v1::trace::NoopTracer> __cdecl std::enable_shared_from_this<class opentelemetry::v1::trace::NoopTracer>::weak_from_this(void) __ptr64, 0x00005600, Microsoft

114 (0x0072), (0x), public: class std::weak_ptr<class opentelemetry::v1::trace::NoopTracer const > __cdecl std::enable_shared_from_this<class opentelemetry::v1::trace::NoopTracer>::weak_from_this(void)const __ptr64, 0x000088a5, Microsoft

Additional context The built dll is about 2mb. If i’ve forgotten to add something to the issue let me know and i will add it.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 20 (13 by maintainers)

Most upvoted comments

@ThomsonTan Since PR #2450 was merged recently, would it be possible to also add a pipeline defining OPENTELEMETRY_BUILD_DLL=ON that ensures the examples/tests actually build/run successfully? 😃

We are still struggling with this issue, and this information (whether it does build and run in CI) would be very useful.

I’m able to build the DLL and run the example_simple program without any issues on my side. From what I can see, example_simple also uses the SetTracerProvider symbol:

trace_api::Provider::SetTracerProvider(provider);

Here is my CMake configuration for reference:

"cacheVariables": {
  "CMAKE_BUILD_TYPE": "Debug",
  "BUILD_TESTING": "ON",
  "WITH_STL":  "ON",
  "WITH_OTLP_GRPC": "ON",
  "WITH_OTLP_HTTP": "ON",
  "WITH_FUNC_TESTS": "ON",
  "WITH_EXAMPLES_HTTP": "ON",
  "WITH_EXAMPLES": "ON",
  "WITH_ABI_VERSION": "1",
  "CMAKE_CXX_STANDARD": "20",
  "OPENTELEMETRY_BUILD_DLL": "ON"
}

From what I can see in the CI, all three of the examples were built and ran successfully.

@ThomsonTan @marcalff @perhapsmaple Finally, I found the reason for the build failure: missing definition of OPENTELEMETRY_STL_VERSION=2023 client-side. This is invisible when building otel-cpp because we have set WITH_STL=ON. This took quite a while to figure out, lots of blind alleys 😃

Hopefully, all build issues are resolved now.

?SetTracerProvider@Provider@trace@v1@opentelemetry@@SAXV?$shared_ptr@VTracerProvider@trace@v1@opentelemetry@@@std@@@Z
?SetTracerProvider@Provider@trace@v1@opentelemetry@@SAXV?$shared_ptr@VTracerProvider@trace@v1@opentelemetry@@@nostd@34@@Z

C:\Program Files\Microsoft Visual Studio\2022\Enterprise>undname /?
Microsoft (R) C++ Name Undecorator
Copyright (C) Microsoft Corporation. All rights reserved.

Usage: undname [flags] fname [fname...]
   or: undname [flags] file

C:\Program Files\Microsoft Visual Studio\2022\Enterprise>undname ?SetTracerProvider@Provider@trace@v1@opentelemetry@@SAXV?$shared_ptr@VTracerProvider@trace@v1@opentelemetry@@@std@@@Z
Microsoft (R) C++ Name Undecorator
Copyright (C) Microsoft Corporation. All rights reserved.

Undecoration of :- "?SetTracerProvider@Provider@trace@v1@opentelemetry@@SAXV?$shared_ptr@VTracerProvider@trace@v1@opentelemetry@@@std@@@Z"
is :- "public: static void __cdecl opentelemetry::v1::trace::Provider::SetTracerProvider(class std::shared_ptr<class opentelemetry::v1::trace::TracerProvider>)"


C:\Program Files\Microsoft Visual Studio\2022\Enterprise>undname ?SetTracerProvider@Provider@trace@v1@opentelemetry@@SAXV?$shared_ptr@VTracerProvider@trace@v1@opentelemetry@@@nostd@34@@Z
Microsoft (R) C++ Name Undecorator
Copyright (C) Microsoft Corporation. All rights reserved.

Undecoration of :- "?SetTracerProvider@Provider@trace@v1@opentelemetry@@SAXV?$shared_ptr@VTracerProvider@trace@v1@opentelemetry@@@nostd@34@@Z"
is :- "public: static void __cdecl opentelemetry::v1::trace::Provider::SetTracerProvider(class opentelemetry::v1::nostd::shared_ptr<class opentelemetry::v1::trace::TracerProvider>)"


C:\Program Files\Microsoft Visual Studio\2022\Enterprise>

Update:

We can use this issue number, no need to create a different one.

Is SetTracerProvider the only symbol missing at this point ?

Sorry I missed it in all the logs.

cc @perhapsmaple , if you want to provide the fix for the export (I still don’t have windows).

After some more testing, i think the only missing actual symbol is SetTracerProvider family of functions (setlogger, setmetric). Those are not present in the opentelemetry_cpp.src file in the ext/dll folder on the master branch. That would fix the issue i’m having i believe.