While installing openpose.
Build failing with error: Undefined symbols for architecture x86_64 in in libcaffeproto.a(caffe.pb.cc.o)
make -jnproc
[ 12%] Performing build step for 'openpose_lib'
[ 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
GCC detected, adding compile flags
Building CPU Only.
CMake Warning at /usr/local/lib/cmake/boost_system-1.71.0/libboost_system-variant-shared.cmake:59 (message):
Target Boost::system already has an imported location
'/usr/local/lib/libboost_system-mt.dylib', which will be overwritten with
'/usr/local/lib/libboost_system.dylib'
Call Stack (most recent call first):
/usr/local/lib/cmake/boost_system-1.71.0/boost_system-config.cmake:43 (include)
/usr/local/lib/cmake/Boost-1.71.0/BoostConfig.cmake:117 (find_package)
/usr/local/lib/cmake/Boost-1.71.0/BoostConfig.cmake:182 (boost_find_component)
/Applications/CMake.app/Contents/share/cmake-3.15/Modules/FindBoost.cmake:443 (find_package)
CMakeLists.txt:345 (find_package)
Found gflags (include: /usr/local/include, library: /usr/local/lib/libgflags.dylib)
Found glog (include: /usr/local/include, library: /usr/local/lib/libglog.dylib)
CMake Warning at /Applications/CMake.app/Contents/share/cmake-3.15/Modules/FindProtobuf.cmake:499 (message):
Protobuf compiler version 3.6.1 doesn't match library version 3.7.1
Call Stack (most recent call first):
CMakeLists.txt:431 (find_package)
Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES)
Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES)
Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND)
Caffe will be downloaded from source now. NOTE: This process might take several minutes depending
on your internet connection.
Caffe has already been downloaded.
HEAD is now at b5ede488 Added TX2 JetPack3.3 support
Caffe will be built from source now.
Download the models.
Downloading BODY_25 model...
Model already exists.
Not downloading body (COCO) model
Not downloading body (MPI) model
Downloading face model...
Model already exists.
Downloading hand model...
Model already exists.
Models Downloaded.
Configuring done
Generating done
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