pythonopencvcmakeopenpose

OpenPose : Undefined symbols for architecture x86_64: libcaffeproto.a(caffe.pb.cc.o)


During the installation of openpose, dependencies being installed. Upon making the build using - make -jnproc

I received the following error:

[  3%] Built target caffeproto
[  3%] Linking CXX shared library ../../lib/libcaffe.dylib
Undefined symbols for architecture x86_64:
  "google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))", referenced from:
      protobuf_caffe_2eproto::AddDescriptorsImpl() in libcaffeproto.a(caffe.pb.cc.o)
  "google::protobuf::internal::RegisterAllTypes(google::protobuf::Metadata const*, int)", referenced from:
      protobuf_caffe_2eproto::protobuf_RegisterTypes(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libcaffeproto.a(caffe.pb.cc.o)
  "google::protobuf::internal::AssignDescriptors(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, google::protobuf::internal::MigrationSchema const*, google::protobuf::Message const* const*, unsigned int const*, google::protobuf::Metadata*, google::protobuf::EnumDescriptor const**, google::protobuf::ServiceDescriptor const**)", referenced from:
      protobuf_caffe_2eproto::protobuf_AssignDescriptors() in libcaffeproto.a(caffe.pb.cc.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[5]: *** [lib/libcaffe.1.0.0.dylib] Error 1
make[4]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
make[3]: *** [all] Error 2
make[2]: *** [caffe/src/openpose_lib-stamp/openpose_lib-build] Error 2
make[1]: *** [CMakeFiles/openpose_lib.dir/all] Error 2
make: *** [all] Error 2 ```

Solution

  • [Resolved]

    This was basically arising because of the different versions of protobuf compilers as mentions in CmakeList.txt and the ones available.

    If you're facing this issue, try removing the obsolete one.

    And even if it doesn't work, do it manually using

    protoc src/caffe/proto/caffe.proto --cpp_out=.
    mkdir include/caffe/proto
    mv src/caffe/proto/caffe.pb.h include/caffe/proto