Search code examples
c++protocol-buffersgoogle-speech-apiprotobuf-c

Google Speech recognition (cpp samples): undefined reference to AssignDescriptors()


This seems to be a protobuf linking error. I am describing the steps that I followed to get here.

NOTE: Following links are to install the protocol buffer compiler and gRPC. If you already have a running gRPC system then you can skip it

NOTE: Following link is to get and run the sample codes provided by Google for speech recognition applications.

On step 9 - make run_tests, I am getting this error

g++ transcribe.o parse_arguments.o googleapis.ar -L/usr/local/lib `pkg-config --libs grpc++ grpc` -Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed -lprotobuf -lpthread -ldl -o transcribe

/usr/local/lib/libgrpc++_reflection.so: undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::AssignDescriptorsTable*)'

/usr/local/lib/libgrpc++_reflection.so: undefined reference to `google::protobuf::internal::AddDescriptors(google::protobuf::internal::DescriptorTable*, void (* const*)(), int)'

collect2: error: ld returned 1 exit status
  1. I am unable to check whether AssignDescriptors and AddDescriptors are declared and defined correctly. Where Can I find these functions declared?

  2. Is there and flag or link I am missing to add?

Any positive help will be appreciated. Thanks


Solution

  • I observed that the grpc++ version 1.19 do not support protobuf-c version 15.

    To make this work, I changed the symlink pointer from libprotobuf-c.so.15 to libprotobuf-c.so.17.