From e218d815b8c2d427847135f36dcdd232a3c15344 Mon Sep 17 00:00:00 2001 From: owentou Date: Tue, 26 Oct 2021 22:47:36 +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 | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/exporters/otlp/src/otlp_http_client.cc b/exporters/otlp/src/otlp_http_client.cc index cd6ae11867..fdfbba2e67 100644 --- a/exporters/otlp/src/otlp_http_client.cc +++ b/exporters/otlp/src/otlp_http_client.cc @@ -11,7 +11,21 @@ #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 +# include +#endif #include "opentelemetry/exporters/otlp/protobuf_include_suffix.h"