From 609ab83b62de0841c676fc0ec6eafa0256d2719e Mon Sep 17 00:00:00 2001 From: owentou Date: Tue, 26 Oct 2021 22:51:48 +0800 Subject: [PATCH] Using legacy `LIBPROTOBUF_EXPORT` with old version of protobuf Support old protobuf for OtlpHttp*Exporter Signed-off-by: owentou --- exporters/otlp/src/otlp_http_client.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/exporters/otlp/src/otlp_http_client.cc b/exporters/otlp/src/otlp_http_client.cc index cd6ae11867..df494dc9fa 100644 --- a/exporters/otlp/src/otlp_http_client.cc +++ b/exporters/otlp/src/otlp_http_client.cc @@ -11,7 +11,20 @@ #include "google/protobuf/message.h" #include "google/protobuf/reflection.h" -#include "google/protobuf/stubs/strutil.h" +#include "google/protobuf/stubs/common.h" + +#if defined(GOOGLE_PROTOBUF_VERSION) && GOOGLE_PROTOBUF_VERSION >= 3007000 +# include "google/protobuf/stubs/strutil.h" +#else +# include "google/protobuf/stubs/port.h" +namespace google +{ +namespace protobuf +{ +LIBPROTOBUF_EXPORT int Base64Escape(const unsigned char *src, int slen, char *dest, int szdest); +} // namespace protobuf +} // namespace google +#endif #include "opentelemetry/exporters/otlp/protobuf_include_suffix.h"