compiling issue with google protobuff
Opened this issue · 1 comments
Hello,
I am getting a compilation error caused by google protobuf, it does not link the executable compute_image_mean. Does anyone know how to fix this error?
[ 86%] Building CXX object tools/CMakeFiles/caffe.bin.dir/caffe.cpp.o
CMakeFiles/compute_image_mean.dir/compute_image_mean.cpp.o: In function std::string* google::MakeCheckOpString<int, int>(int const&, int const&, char const*)': compute_image_mean.cpp:(.text._ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc]+0x50): undefined reference to
google::base::CheckOpMessageBuilder::NewString()'
CMakeFiles/compute_image_mean.dir/compute_image_mean.cpp.o: In function std::string* google::MakeCheckOpString<unsigned long, int>(unsigned long const&, int const&, char const*)': compute_image_mean.cpp:(.text._ZN6google17MakeCheckOpStringImiEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringImiEEPSsRKT_RKT0_PKc]+0x50): undefined reference to
google::base::CheckOpMessageBuilder::NewString()'
CMakeFiles/compute_image_mean.dir/compute_image_mean.cpp.o: In function main': compute_image_mean.cpp:(.text.startup+0x178): undefined reference to
google::SetUsageMessage(std::string const&)'
compute_image_mean.cpp:(.text.startup+0x2b1): undefined reference to google::protobuf::MessageLite::ParseFromString(std::string const&)' compute_image_mean.cpp:(.text.startup+0x499): undefined reference to
google::protobuf::MessageLite::ParseFromString(std::string const&)'
../lib/libcaffe.so: undefined reference to google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(int, std::string const&, google::protobuf::io::CodedOutputStream*)' ../lib/libcaffe.so: undefined reference to
google::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray(std::string const&, unsigned char*)'
../lib/libcaffe.so: undefined reference to google::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream*, std::string*)' ../lib/libcaffe.so: undefined reference to
google::protobuf::Message::GetTypeName() const'
../lib/libcaffe.so: undefined reference to google::protobuf::internal::StringTypeHandlerBase::Delete(std::string*)' ../lib/libcaffe.so: undefined reference to
google::protobuf::MessageLite::SerializeToString(std::string*) const'
../lib/libcaffe.so: undefined reference to google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::string const&))' ../lib/libcaffe.so: undefined reference to
leveldb::DB::Open(leveldb::Options const&, std::string const&, leveldb::DB**)'
../lib/libcaffe.so: undefined reference to google::protobuf::Message::DebugString() const' ../lib/libcaffe.so: undefined reference to
google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(int, std::string const&, google::protobuf::io::CodedOutputStream*)'
../lib/libcaffe.so: undefined reference to google::protobuf::internal::StringTypeHandlerBase::New()' ../lib/libcaffe.so: undefined reference to
google::protobuf::internal::empty_string_'
../lib/libcaffe.so: undefined reference to google::protobuf::internal::NameOfEnum(google::protobuf::EnumDescriptor const*, int)' ../lib/libcaffe.so: undefined reference to
google::protobuf::internal::WireFormatLite::WriteString(int, std::string const&, google::protobuf::io::CodedOutputStream*)'
../lib/libcaffe.so: undefined reference to leveldb::Status::ToString() const' ../lib/libcaffe.so: undefined reference to
google::protobuf::DescriptorPool::FindFileByName(std::string const&) const'
../lib/libcaffe.so: undefined reference to google::protobuf::internal::WireFormatLite::ReadBytes(google::protobuf::io::CodedInputStream*, std::string*)' ../lib/libcaffe.so: undefined reference to
google::protobuf::Message::InitializationErrorString() const'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/compute_image_mean.dir/build.make:144: recipe for target 'tools/compute_image_mean' failed
make[2]: *** [tools/compute_image_mean] Error 1
CMakeFiles/Makefile2:439: recipe for target 'tools/CMakeFiles/compute_image_mean.dir/all' failed
make[1]: *** [tools/CMakeFiles/compute_image_mean.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
I also encountered this problem and it has been solved.
We need to install a lower version of protobuf, such as 2., but when compiling caffe, the system uses the 3. protobuf in Anaconda.
So, you may try "https://www.zhihu.com/question/58592005/answer/188884890",
or
pip uninstall protobuf