Build Caffe: undefined reference to `google::protobuf::internal:

Hi, 
    I git clone "caffe" source codes, and have done installation, but when I execute "make all" in the Caffe folder, I encountered the below errors. (.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal:)
    So, could you pls give me some suggestions? Thanks!
 
CXX/LD -o .build_release/tools/upgrade_net_proto_binary.bin
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(google::protobuf::Descriptor const*, google::protobuf::Message const*, int const*, int, int, int, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream*, std::string*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::StringTypeHandlerBase::Delete(std::string*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::kEmptyString'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedOutputStream::VarintSize32Fallback(unsigned int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::ReadVarint64Fallback(unsigned long*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::StringTypeHandlerBase::New()'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedOutputStream::WriteVarint32(unsigned int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::ReadTagFallback()'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::UnknownFieldSet::UnknownFieldSet()'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::RepeatedPtrFieldBase::Swap(google::protobuf::internal::RepeatedPtrFieldBase*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedOutputStream::VarintSize64(unsigned long)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::Message::SpaceUsed() const'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedOutputStream::WriteVarint64ToArray(unsigned long, unsigned char*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::UnknownFieldSet::~UnknownFieldSet()'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::ReadVarint32Fallback(unsigned int*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedOutputStream::WriteVarint32FallbackToArray(unsigned int, unsigned char*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedOutputStream::WriteVarint64(unsigned long)'
collect2: error: ld returned 1 exit status
make: *** [.build_release/tools/upgrade_net_proto_binary.bin] Error 1
已邀请:

muyouhang

赞同来自:

你可能是protobuf的版本不对,更新为最新的吧

Care_Shaw

赞同来自:

我用gcc6.3编译的,也出现类似的问题,
后来在make all -j8之前添加了两行命令:
export CC=/usr/bin/clang-3.8
export CXX=/usr/bin/clang++-3.8
可以编译通过

要回复问题请先登录注册