open-telemetry / opentelemetry-cpp

The OpenTelemetry C++ Client
https://opentelemetry.io/
Apache License 2.0
840 stars 403 forks source link

Getting ld: error: undefined symbol: google::protobuf::internal::ArenaStringPtr::Set while cross-compiling #2201

Open KaustubhDandekar opened 1 year ago

KaustubhDandekar commented 1 year ago

Hi I am getting linking error while trying to cross-compile opentelemetry for android platform when OTLP_HTTP is set to true. Installed protobuf version 3.21.12 using homebrew on my mac. Sharing the options set on cmake command

    -DWITH_STL=ON \
    -DWITH_OTLP_HTTP=ON \
    -DProtobuf_USE_STATIC_LIBS=ON \
    -DPROTOBUF_PROTOC_EXECUTABLE=/usr/local/Cellar/protobuf@21/21.12/bin/protoc \
    -DProtobuf_PROTOC_LIBRARY=/usr/local/Cellar/protobuf@21/21.12/lib/libprotoc.a \
    -DProtobuf_LIBRARY=/usr/local/Cellar/protobuf@21/21.12/lib/libprotobuf.a \
    -DProtobuf_LITE_LIBRARY=/usr/local/Cellar/protobuf@21/21.12/lib/libprotobuf-lite.a \
    -DProtobuf_INCLUDE_DIR=/usr/local/Cellar/protobuf@21/21.12/include \
[ 95%] Linking CXX static library libopentelemetry_exporter_ostream_metrics.a
[ 95%] Built target opentelemetry_exporter_ostream_metrics
[ 96%] Linking CXX static library libopentelemetry_exporter_otlp_http_metric.a
[ 96%] Built target opentelemetry_exporter_otlp_http_metric
[ 97%] Linking CXX static library libopentelemetry_exporter_otlp_http.a
[ 97%] Built target opentelemetry_exporter_otlp_http
[ 98%] Building CXX object functional/otlp/CMakeFiles/func_otlp_http.dir/func_http_main.cc.o
[100%] Linking CXX executable func_otlp_http
ld: error: undefined symbol: google::protobuf::internal::ArenaStringPtr::Set(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >&&, google::protobuf::Arena*)
>>> referenced by trace.pb.h:2569 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/build/generated/third_party/opentelemetry-proto/opentelemetry/proto/trace/v1/trace.pb.h:2569)
>>>               otlp_recordable.cc.o:(opentelemetry::v1::exporter::otlp::OtlpRecordable::SetIdentity(opentelemetry::v1::trace::SpanContext const&, opentelemetry::v1::trace::SpanId)) in archive ../../exporters/otlp/libopentelemetry_otlp_recordable.a
>>> referenced by trace.pb.h:2358 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/build/generated/third_party/opentelemetry-proto/opentelemetry/proto/trace/v1/trace.pb.h:2358)
>>>               otlp_recordable.cc.o:(opentelemetry::v1::exporter::otlp::OtlpRecordable::AddLink(opentelemetry::v1::trace::SpanContext const&, opentelemetry::v1::common::KeyValueIterable const&)) in archive ../../exporters/otlp/libopentelemetry_otlp_recordable.a

ld: error: undefined symbol: google::protobuf::internal::ArenaStringPtr::Set(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, google::protobuf::Arena*)
>>> referenced by common.pb.h:1744 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/build/generated/third_party/opentelemetry-proto/opentelemetry/proto/common/v1/common.pb.h:1744)
>>>               otlp_recordable.cc.o:(opentelemetry::v1::exporter::otlp::OtlpRecordable::GetProtoInstrumentationScope() const) in archive ../../exporters/otlp/libopentelemetry_otlp_recordable.a
>>> referenced by common.pb.h:1794 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/build/generated/third_party/opentelemetry-proto/opentelemetry/proto/common/v1/common.pb.h:1794)
>>>               otlp_recordable.cc.o:(opentelemetry::v1::exporter::otlp::OtlpRecordable::GetProtoInstrumentationScope() const) in archive ../../exporters/otlp/libopentelemetry_otlp_recordable.a
>>> referenced by arenastring.h:429 (/usr/local/Cellar/protobuf@21/21.12/include/google/protobuf/arenastring.h:429)
>>>               otlp_recordable.cc.o:(google::protobuf::internal::ArenaStringPtr::SetBytes(void const*, unsigned int, google::protobuf::Arena*)) in archive ../../exporters/otlp/libopentelemetry_otlp_recordable.a
>>> referenced 22 more times

ld: error: undefined symbol: google::protobuf::internal::RepeatedPtrFieldBase::AddOutOfLineHelper(void*)
>>> referenced by repeated_ptr_field.h:218 (/usr/local/Cellar/protobuf@21/21.12/include/google/protobuf/repeated_ptr_field.h:218)
>>>               otlp_recordable.cc.o:(google::protobuf::RepeatedPtrField<opentelemetry::proto::common::v1::KeyValue>::TypeHandler::Type* google::protobuf::internal::RepeatedPtrFieldBase::Add<google::protobuf::RepeatedPtrField<opentelemetry::proto::common::v1::KeyValue>::TypeHandler>(google::protobuf::RepeatedPtrField<opentelemetry::proto::common::v1::KeyValue>::TypeHandler::Type const*)) in archive ../../exporters/otlp/libopentelemetry_otlp_recordable.a
>>> referenced by repeated_ptr_field.h:218 (/usr/local/Cellar/protobuf@21/21.12/include/google/protobuf/repeated_ptr_field.h:218)
>>>               otlp_recordable.cc.o:(google::protobuf::RepeatedPtrField<opentelemetry::proto::trace::v1::Span_Event>::TypeHandler::Type* google::protobuf::internal::RepeatedPtrFieldBase::Add<google::protobuf::RepeatedPtrField<opentelemetry::proto::trace::v1::Span_Event>::TypeHandler>(google::protobuf::RepeatedPtrField<opentelemetry::proto::trace::v1::Span_Event>::TypeHandler::Type const*)) in archive ../../exporters/otlp/libopentelemetry_otlp_recordable.a
>>> referenced by repeated_ptr_field.h:218 (/usr/local/Cellar/protobuf@21/21.12/include/google/protobuf/repeated_ptr_field.h:218)
>>>               otlp_recordable.cc.o:(google::protobuf::RepeatedPtrField<opentelemetry::proto::trace::v1::Span_Link>::TypeHandler::Type* google::protobuf::internal::RepeatedPtrFieldBase::Add<google::protobuf::RepeatedPtrField<opentelemetry::proto::trace::v1::Span_Link>::TypeHandler>(google::protobuf::RepeatedPtrField<opentelemetry::proto::trace::v1::Span_Link>::TypeHandler::Type const*)) in archive ../../exporters/otlp/libopentelemetry_otlp_recordable.a
>>> referenced 4 more times

ld: error: undefined symbol: google::protobuf::internal::fixed_address_empty_string
>>> referenced by common.pb.h:0 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/build/generated/third_party/opentelemetry-proto/opentelemetry/proto/common/v1/common.pb.h:0)
>>>               otlp_populate_attribute_utils.cc.o:(void opentelemetry::proto::common::v1::AnyValue::set_string_value<char const* const&>(char const* const&)) in archive ../../exporters/otlp/libopentelemetry_otlp_recordable.a
>>> referenced by common.pb.h:0 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/build/generated/third_party/opentelemetry-proto/opentelemetry/proto/common/v1/common.pb.h:0)
>>>               otlp_populate_attribute_utils.cc.o:(void opentelemetry::proto::common::v1::AnyValue::set_string_value<char const*, unsigned int>(char const*&&, unsigned int)) in archive ../../exporters/otlp/libopentelemetry_otlp_recordable.a
>>> referenced by common.pb.h:0 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/build/generated/third_party/opentelemetry-proto/opentelemetry/proto/common/v1/common.pb.h:0)
>>>               otlp_populate_attribute_utils.cc.o:(void opentelemetry::proto::common::v1::AnyValue::set_string_value<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&>(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)) in archive ../../exporters/otlp/libopentelemetry_otlp_recordable.a
>>> referenced 20 more times

ld: error: undefined symbol: google::protobuf::MessageLite::SerializeWithCachedSizesToArray(unsigned char*) const
>>> referenced by otlp_http_client.cc:472 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/exporters/otlp/src/otlp_http_client.cc:472)
>>>               otlp_http_client.cc.o:(opentelemetry::v1::exporter::otlp::OtlpHttpClient::createSession(google::protobuf::Message const&, std::__ndk1::function<bool (opentelemetry::v1::sdk::common::ExportResult)>&&)) in archive ../../exporters/otlp/libopentelemetry_exporter_otlp_http_client.a

ld: error: undefined symbol: google::protobuf::Message::Utf8DebugString() const
>>> referenced by otlp_http_client.cc:916 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/exporters/otlp/src/otlp_http_client.cc:916)
>>>               otlp_http_client.cc.o:(opentelemetry::v1::exporter::otlp::OtlpHttpClient::createSession(google::protobuf::Message const&, std::__ndk1::function<bool (opentelemetry::v1::sdk::common::ExportResult)>&&)) in archive ../../exporters/otlp/libopentelemetry_exporter_otlp_http_client.a

ld: error: undefined symbol: google::protobuf::Reflection::ListFields(google::protobuf::Message const&, std::__ndk1::vector<google::protobuf::FieldDescriptor const*, std::__ndk1::allocator<google::protobuf::FieldDescriptor const*> >*) const
>>> referenced by otlp_http_client.cc:449 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/exporters/otlp/src/otlp_http_client.cc:449)
>>>               otlp_http_client.cc.o:(opentelemetry::v1::exporter::otlp::(anonymous namespace)::ConvertGenericMessageToJson(nlohmann::json_abi_v3_11_2::basic_json<std::__ndk1::map, std::__ndk1::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long long, unsigned long long, double, std::__ndk1::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >&, google::protobuf::Message const&, opentelemetry::v1::exporter::otlp::OtlpHttpClientOptions const&)) in archive ../../exporters/otlp/libopentelemetry_exporter_otlp_http_client.a

ld: error: undefined symbol: google::protobuf::Reflection::FieldSize(google::protobuf::Message const&, google::protobuf::FieldDescriptor const*) const
>>> referenced by otlp_http_client.cc:551 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/exporters/otlp/src/otlp_http_client.cc:551)
>>>               otlp_http_client.cc.o:(opentelemetry::v1::exporter::otlp::(anonymous namespace)::ConvertGenericMessageToJson(nlohmann::json_abi_v3_11_2::basic_json<std::__ndk1::map, std::__ndk1::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long long, unsigned long long, double, std::__ndk1::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >&, google::protobuf::Message const&, opentelemetry::v1::exporter::otlp::OtlpHttpClientOptions const&)) in archive ../../exporters/otlp/libopentelemetry_exporter_otlp_http_client.a

ld: error: undefined symbol: google::protobuf::Reflection::GetRepeatedInt32(google::protobuf::Message const&, google::protobuf::FieldDescriptor const*, int) const
>>> referenced by otlp_http_client.cc:558 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/exporters/otlp/src/otlp_http_client.cc:558)
>>>               otlp_http_client.cc.o:(opentelemetry::v1::exporter::otlp::(anonymous namespace)::ConvertGenericMessageToJson(nlohmann::json_abi_v3_11_2::basic_json<std::__ndk1::map, std::__ndk1::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long long, unsigned long long, double, std::__ndk1::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >&, google::protobuf::Message const&, opentelemetry::v1::exporter::otlp::OtlpHttpClientOptions const&)) in archive ../../exporters/otlp/libopentelemetry_exporter_otlp_http_client.a

ld: error: undefined symbol: google::protobuf::Reflection::GetInt32(google::protobuf::Message const&, google::protobuf::FieldDescriptor const*) const
>>> referenced by otlp_http_client.cc:486 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/exporters/otlp/src/otlp_http_client.cc:486)
>>>               otlp_http_client.cc.o:(opentelemetry::v1::exporter::otlp::(anonymous namespace)::ConvertGenericMessageToJson(nlohmann::json_abi_v3_11_2::basic_json<std::__ndk1::map, std::__ndk1::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long long, unsigned long long, double, std::__ndk1::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >&, google::protobuf::Message const&, opentelemetry::v1::exporter::otlp::OtlpHttpClientOptions const&)) in archive ../../exporters/otlp/libopentelemetry_exporter_otlp_http_client.a

ld: error: undefined symbol: google::protobuf::Reflection::GetInt64(google::protobuf::Message const&, google::protobuf::FieldDescriptor const*) const
>>> referenced by otlp_http_client.cc:492 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/exporters/otlp/src/otlp_http_client.cc:492)
>>>               otlp_http_client.cc.o:(opentelemetry::v1::exporter::otlp::(anonymous namespace)::ConvertGenericMessageToJson(nlohmann::json_abi_v3_11_2::basic_json<std::__ndk1::map, std::__ndk1::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long long, unsigned long long, double, std::__ndk1::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >&, google::protobuf::Message const&, opentelemetry::v1::exporter::otlp::OtlpHttpClientOptions const&)) in archive ../../exporters/otlp/libopentelemetry_exporter_otlp_http_client.a

ld: error: undefined symbol: google::protobuf::Reflection::GetUInt32(google::protobuf::Message const&, google::protobuf::FieldDescriptor const*) const
>>> referenced by otlp_http_client.cc:496 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/exporters/otlp/src/otlp_http_client.cc:496)
>>>               otlp_http_client.cc.o:(opentelemetry::v1::exporter::otlp::(anonymous namespace)::ConvertGenericMessageToJson(nlohmann::json_abi_v3_11_2::basic_json<std::__ndk1::map, std::__ndk1::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long long, unsigned long long, double, std::__ndk1::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >&, google::protobuf::Message const&, opentelemetry::v1::exporter::otlp::OtlpHttpClientOptions const&)) in archive ../../exporters/otlp/libopentelemetry_exporter_otlp_http_client.a

ld: error: undefined symbol: google::protobuf::Reflection::GetUInt64(google::protobuf::Message const&, google::protobuf::FieldDescriptor const*) const
>>> referenced by otlp_http_client.cc:502 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/exporters/otlp/src/otlp_http_client.cc:502)
>>>               otlp_http_client.cc.o:(opentelemetry::v1::exporter::otlp::(anonymous namespace)::ConvertGenericMessageToJson(nlohmann::json_abi_v3_11_2::basic_json<std::__ndk1::map, std::__ndk1::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long long, unsigned long long, double, std::__ndk1::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >&, google::protobuf::Message const&, opentelemetry::v1::exporter::otlp::OtlpHttpClientOptions const&)) in archive ../../exporters/otlp/libopentelemetry_exporter_otlp_http_client.a

ld: error: undefined symbol: google::protobuf::Reflection::GetDouble(google::protobuf::Message const&, google::protobuf::FieldDescriptor const*) const
>>> referenced by otlp_http_client.cc:525 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/exporters/otlp/src/otlp_http_client.cc:525)
>>>               otlp_http_client.cc.o:(opentelemetry::v1::exporter::otlp::(anonymous namespace)::ConvertGenericMessageToJson(nlohmann::json_abi_v3_11_2::basic_json<std::__ndk1::map, std::__ndk1::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long long, unsigned long long, double, std::__ndk1::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >&, google::protobuf::Message const&, opentelemetry::v1::exporter::otlp::OtlpHttpClientOptions const&)) in archive ../../exporters/otlp/libopentelemetry_exporter_otlp_http_client.a

ld: error: undefined symbol: google::protobuf::Reflection::GetFloat(google::protobuf::Message const&, google::protobuf::FieldDescriptor const*) const
>>> referenced by otlp_http_client.cc:529 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/exporters/otlp/src/otlp_http_client.cc:529)
>>>               otlp_http_client.cc.o:(opentelemetry::v1::exporter::otlp::(anonymous namespace)::ConvertGenericMessageToJson(nlohmann::json_abi_v3_11_2::basic_json<std::__ndk1::map, std::__ndk1::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long long, unsigned long long, double, std::__ndk1::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >&, google::protobuf::Message const&, opentelemetry::v1::exporter::otlp::OtlpHttpClientOptions const&)) in archive ../../exporters/otlp/libopentelemetry_exporter_otlp_http_client.a

ld: error: undefined symbol: google::protobuf::Reflection::GetBool(google::protobuf::Message const&, google::protobuf::FieldDescriptor const*) const
>>> referenced by otlp_http_client.cc:533 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/exporters/otlp/src/otlp_http_client.cc:533)
>>>               otlp_http_client.cc.o:(opentelemetry::v1::exporter::otlp::(anonymous namespace)::ConvertGenericMessageToJson(nlohmann::json_abi_v3_11_2::basic_json<std::__ndk1::map, std::__ndk1::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long long, unsigned long long, double, std::__ndk1::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >&, google::protobuf::Message const&, opentelemetry::v1::exporter::otlp::OtlpHttpClientOptions const&)) in archive ../../exporters/otlp/libopentelemetry_exporter_otlp_http_client.a

ld: error: undefined symbol: google::protobuf::Reflection::GetEnumValue(google::protobuf::Message const&, google::protobuf::FieldDescriptor const*) const
>>> referenced by otlp_http_client.cc:537 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/exporters/otlp/src/otlp_http_client.cc:537)
>>>               otlp_http_client.cc.o:(opentelemetry::v1::exporter::otlp::(anonymous namespace)::ConvertGenericMessageToJson(nlohmann::json_abi_v3_11_2::basic_json<std::__ndk1::map, std::__ndk1::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long long, unsigned long long, double, std::__ndk1::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >&, google::protobuf::Message const&, opentelemetry::v1::exporter::otlp::OtlpHttpClientOptions const&)) in archive ../../exporters/otlp/libopentelemetry_exporter_otlp_http_client.a

ld: error: undefined symbol: google::protobuf::Reflection::GetStringReference(google::protobuf::Message const&, google::protobuf::FieldDescriptor const*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >*) const
>>> referenced by otlp_http_client.cc:510 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/exporters/otlp/src/otlp_http_client.cc:510)
>>>               otlp_http_client.cc.o:(opentelemetry::v1::exporter::otlp::(anonymous namespace)::ConvertGenericMessageToJson(nlohmann::json_abi_v3_11_2::basic_json<std::__ndk1::map, std::__ndk1::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long long, unsigned long long, double, std::__ndk1::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >&, google::protobuf::Message const&, opentelemetry::v1::exporter::otlp::OtlpHttpClientOptions const&)) in archive ../../exporters/otlp/libopentelemetry_exporter_otlp_http_client.a
>>> referenced by otlp_http_client.cc:515 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/exporters/otlp/src/otlp_http_client.cc:515)
>>>               otlp_http_client.cc.o:(opentelemetry::v1::exporter::otlp::(anonymous namespace)::ConvertGenericMessageToJson(nlohmann::json_abi_v3_11_2::basic_json<std::__ndk1::map, std::__ndk1::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long long, unsigned long long, double, std::__ndk1::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >&, google::protobuf::Message const&, opentelemetry::v1::exporter::otlp::OtlpHttpClientOptions const&)) in archive ../../exporters/otlp/libopentelemetry_exporter_otlp_http_client.a

ld: error: undefined symbol: google::protobuf::Reflection::GetMessage(google::protobuf::Message const&, google::protobuf::FieldDescriptor const*, google::protobuf::MessageFactory*) const
>>> referenced by otlp_http_client.cc:521 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/exporters/otlp/src/otlp_http_client.cc:521)
>>>               otlp_http_client.cc.o:(opentelemetry::v1::exporter::otlp::(anonymous namespace)::ConvertGenericMessageToJson(nlohmann::json_abi_v3_11_2::basic_json<std::__ndk1::map, std::__ndk1::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long long, unsigned long long, double, std::__ndk1::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >&, google::protobuf::Message const&, opentelemetry::v1::exporter::otlp::OtlpHttpClientOptions const&)) in archive ../../exporters/otlp/libopentelemetry_exporter_otlp_http_client.a

ld: error: undefined symbol: google::protobuf::Reflection::GetRepeatedInt64(google::protobuf::Message const&, google::protobuf::FieldDescriptor const*, int) const
>>> referenced by otlp_http_client.cc:569 (/Users/kaustubh.dandekar/workspace/telemetry/csl-third-party/build/opentelemetry/exporters/otlp/src/otlp_http_client.cc:569)
>>>               otlp_http_client.cc.o:(opentelemetry::v1::exporter::otlp::(anonymous namespace)::ConvertGenericMessageToJson(nlohmann::json_abi_v3_11_2::basic_json<std::__ndk1::map, std::__ndk1::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long long, unsigned long long, double, std::__ndk1::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >&, google::protobuf::Message const&, opentelemetry::v1::exporter::otlp::OtlpHttpClientOptions const&)) in archive ../../exporters/otlp/libopentelemetry_exporter_otlp_http_client.a

ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [functional/otlp/func_otlp_http] Error 1
make[1]: *** [functional/otlp/CMakeFiles/func_otlp_http.dir/all] Error 2
make: *** [all] Error 2
owent commented 1 year ago

CMAKE_SYSROOT or other simular options should be used to prevent cmake to find packages from host system when crossing compiling. With modern cmake , we do not use Protobuf_LIBRARY, Protobuf_INCLUDE_DIR or any thing set by cmake module, and we use cmake CONFIG package instead.

KaustubhDandekar commented 1 year ago

I am already setting CMAKE_SYSROOT along with android ndk toolchain which is working fine for few other libraries. If I don't set the Protobuf_INCLUDE_DIR option it throws following error

-- Could NOT find Protobuf (missing: Protobuf_LIBRARIES Protobuf_INCLUDE_DIR) 
CMake Error at /usr/local/Cellar/cmake/3.26.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Protobuf (missing: Protobuf_LIBRARIES Protobuf_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.26.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/Cellar/cmake/3.26.4/share/cmake/Modules/FindProtobuf.cmake:650 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:378 (find_package)

Not sure what am I missing here.

owent commented 1 year ago

Do you compile protobuf with NDK, could you try to use --debug-find-pkg=Protobuf to check if the search directories contains the directory of installed protobuf?

github-actions[bot] commented 1 year ago

This issue was marked as stale due to lack of activity.