Closed ivgotcrazy closed 1 year ago
This problem has been bothering me for a long time. It looks like a binary compatibility issue. Do I need to set a certain compilation option? Does anybody has good ideas or suggestions?
@ivgotcrazy is this still valid? If yes, is it possible to share the dump file and .pdb files for the related component?
A possible reason to have binary compatibility issues is related to:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus")
opentelemetry-cpp sets this flag when building the library.
An application compiling with the opentelemetry-cpp header files also needs to set this flag.
When not set, the build will contain C++98 code compiled in the application, linked with C++11/14/17/20/23 code depending on the compiler used, when linking the SDK.
Mixing different implementations is likely to produce a corrupt binary, leading to crashes.
Closing.
Binary compatibility issue is suspected to be caused by missing option /Zc:__cplusplus
in Visual Studio.
Describe your environment
Windows/C++17/Visual Studio
CMake parameters as below:
Steps to reproduce
simple code as below, just call the GetTracer method:
namespace trace = opentelemetry::trace; typedef nostd::shared_ptr TracerNSP;
TracerNSP GetTracer(const std::string& tracer_name) { auto provider = trace::Provider::GetTracerProvider(); return provider->GetTracer(tracer_name, OPENTELEMETRY_SDK_VERSION); }
What is the expected behavior? Success
What is the actual behavior?
A runtime error was triggered:
Additional context