From 076effa650d4cc2130c1b4ff9ed261188ae57aeb Mon Sep 17 00:00:00 2001 From: Max Golovanov Date: Tue, 11 May 2021 13:31:03 -0700 Subject: [PATCH 1/2] Add curl via vcpkg to WIndows builds --- tools/setup-buildtools.cmd | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/setup-buildtools.cmd b/tools/setup-buildtools.cmd index 2c0912ca2e..39270b9c7c 100644 --- a/tools/setup-buildtools.cmd +++ b/tools/setup-buildtools.cmd @@ -54,5 +54,6 @@ vcpkg install abseil:x64-windows vcpkg install protobuf:x64-windows vcpkg install gRPC:x64-windows vcpkg install prometheus-cpp:x64-windows +vcpkg install curl:x64-windows popd exit /b 0 From 2b3d5e9586a873488a4331572e5f80d4d21bdf98 Mon Sep 17 00:00:00 2001 From: Max Golovanov Date: Tue, 29 Jun 2021 16:39:56 -0700 Subject: [PATCH 2/2] Resolve compilation issue with Abseil namespaced struct definition coming before no-namespace definition --- examples/otlp/README.md | 15 +++++++++++++++ examples/otlp/grpc_main.cc | 3 +++ 2 files changed, 18 insertions(+) diff --git a/examples/otlp/README.md b/examples/otlp/README.md index 03325cd681..cd85a392a1 100644 --- a/examples/otlp/README.md +++ b/examples/otlp/README.md @@ -49,3 +49,18 @@ default. This can be changed with first argument from command-line, for example: Once you have the Collector running, see [CONTRIBUTING.md](../../CONTRIBUTING.md) for instructions on building and running the example. + +## Additional notes regarding Abseil library + +gRPC internally uses a different version of Abseil than OpenTelemetry C++ SDK. + +One option to optimize your code is to build the SDK with system-provided +Abseil library. If you are using CMake, then `-DWITH_ABSEIL=ON` may be passed +during the build of SDK to reuse the same Abseil library as gRPC. + +If you do not want to pursue the above option, and in case if you run into +conflict between Abseil library and OpenTelemetry C++ `absl::variant` +implementation, please include either `grpcpp/grpcpp.h` or +`opentelemetry/exporters/otlp/otlp_grpc_exporter.h` BEFORE any other API +headers. This approach efficiently avoids the conflict between the two different +versions of Abseil. diff --git a/examples/otlp/grpc_main.cc b/examples/otlp/grpc_main.cc index 7df891ad0a..7789457909 100644 --- a/examples/otlp/grpc_main.cc +++ b/examples/otlp/grpc_main.cc @@ -1,6 +1,9 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +// Make sure to include GRPC exporter first because otherwise Abseil may create +// ambiguity with `nostd::variant`. See issue: +// https://github.com/open-telemetry/opentelemetry-cpp/issues/880 #include "opentelemetry/exporters/otlp/otlp_grpc_exporter.h" #include "opentelemetry/sdk/trace/simple_processor.h" #include "opentelemetry/sdk/trace/tracer_provider.h"