首页 > 解决方案 > 在macOS 10.13中安装caffe时如何解决架构x86_64错误的未定义符号

问题描述

如何解决架构 x86_64 错误的未定义符号。

在 MacOs High Sierra 中安装 Caffe 时出现架构 x86_64 错误的未定义符号。

MacOs High Sierra 版本 10.13.4。

Python 版本:2.7.10。

Clang 版本:Apple LLVM 版本 9.0.0 (clang-900.0.38)

Protobuf 版本:libprotoc 3.3.2

还安装了caffe 安装所需的其他依赖项。

Undefined symbols for architecture x86_64:
  "google::protobuf::MessageLite::ParseFromString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      caffe::DataLayer<float>::DataLayerSetUp(std::__1::vector<caffe::Blob<float>*, std::__1::allocator<caffe::Blob<float>*> > const&, std::__1::vector<caffe::Blob<float>*, std::__1::allocator<caffe::Blob<float>*> > const&) in data_layer.cpp.o
      caffe::DataLayer<float>::load_batch(caffe::Batch<float>*) in data_layer.cpp.o
      caffe::DataLayer<double>::DataLayerSetUp(std::__1::vector<caffe::Blob<double>*, std::__1::allocator<caffe::Blob<double>*> > const&, std::__1::vector<caffe::Blob<double>*, std::__1::allocator<caffe::Blob<double>*> > const&) in data_layer.cpp.o
      caffe::DataLayer<double>::load_batch(caffe::Batch<double>*) in data_layer.cpp.o
  "google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))", referenced from:
      caffe::protobuf_caffe_2eproto::(anonymous namespace)::AddDescriptorsImpl() in libcaffeproto.a(caffe.pb.cc.o)
  "google::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned char*)", referenced from:
      caffe::Datum::InternalSerializeWithCachedSizesToArray(bool, unsigned char*) const in libcaffeproto.a(caffe.pb.cc.o)
      caffe::FillerParameter::InternalSerializeWithCachedSizesToArray(bool, unsigned char*) const in libcaffeproto.a(caffe.pb.cc.o)
      caffe::NetParameter::InternalSerializeWithCachedSizesToArray(bool, unsigned char*) const in libcaffeproto.a(caffe.pb.cc.o)
      caffe::SolverParameter::InternalSerializeWithCachedSizesToArray(bool, unsigned char*) const in libcaffeproto.a(caffe.pb.cc.o)
      caffe::SolverState::InternalSerializeWithCachedSizesToArray(bool, unsigned char*) const in libcaffeproto.a(caffe.pb.cc.o)
      caffe::NetState::InternalSerializeWithCachedSizesToArray(bool, unsigned char*) const in libcaffeproto.a(caffe.pb.cc.o)
      caffe::NetStateRule::InternalSerializeWithCachedSizesToArray(bool, unsigned char*) const in libcaffeproto.a(caffe.pb.cc.o)
      ...
  "google::protobuf::internal::NameOfEnum(google::protobuf::EnumDescriptor const*, int)", referenced from:
      caffe::InfogainLossLayer<float>::get_normalizer(caffe::LossParameter_NormalizationMode, int) in infogain_loss_layer.cpp.o
      caffe::InfogainLossLayer<double>::get_normalizer(caffe::LossParameter_NormalizationMode, int) in infogain_loss_layer.cpp.o
      caffe::ReductionLayer<float>::Forward_cpu(std::__1::vector<caffe::Blob<float>*, std::__1::allocator<caffe::Blob<float>*> > const&, std::__1::vector<caffe::Blob<float>*, std::__1::allocator<caffe::Blob<float>*> > const&) in reduction_layer.cpp.o
      caffe::ReductionLayer<float>::Backward_cpu(std::__1::vector<caffe::Blob<float>*, std::__1::allocator<caffe::Blob<float>*> > const&, std::__1::vector<bool, std::__1::allocator<bool> > const&, std::__1::vector<caffe::Blob<float>*, std::__1::allocator<caffe::Blob<float>*> > const&) in reduction_layer.cpp.o
      caffe::ReductionLayer<double>::Forward_cpu(std::__1::vector<caffe::Blob<double>*, std::__1::allocator<caffe::Blob<double>*> > const&, std::__1::vector<caffe::Blob<double>*, std::__1::allocator<caffe::Blob<double>*> > const&) in reduction_layer.cpp.o
      caffe::ReductionLayer<double>::Backward_cpu(std::__1::vector<caffe::Blob<double>*, std::__1::allocator<caffe::Blob<double>*> > const&, std::__1::vector<bool, std::__1::allocator<bool> > const&, std::__1::vector<caffe::Blob<double>*, std::__1::allocator<caffe::Blob<double>*> > const&) in reduction_layer.cpp.o
      caffe::SigmoidCrossEntropyLossLayer<float>::get_normalizer(caffe::LossParameter_NormalizationMode, int) in sigmoid_cross_entropy_loss_layer.cpp.o
      ...
  "google::protobuf::internal::WireFormatLite::WriteString(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, google::protobuf::io::CodedOutputStream*)", referenced from:
      caffe::NetParameter::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in libcaffeproto.a(caffe.pb.cc.o)
      caffe::SolverParameter::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in libcaffeproto.a(caffe.pb.cc.o)
      caffe::NetState::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in libcaffeproto.a(caffe.pb.cc.o)
      caffe::NetStateRule::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in libcaffeproto.a(caffe.pb.cc.o)
      caffe::LayerParameter::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in libcaffeproto.a(caffe.pb.cc.o)
      caffe::V1LayerParameter::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in libcaffeproto.a(caffe.pb.cc.o)
  "google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, google::protobuf::io::CodedOutputStream*)", referenced from:
      caffe::Datum::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in libcaffeproto.a(caffe.pb.cc.o)
  "google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, google::protobuf::io::CodedOutputStream*)", referenced from:
      caffe::FillerParameter::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in libcaffeproto.a(caffe.pb.cc.o)
      caffe::NetParameter::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in libcaffeproto.a(caffe.pb.cc.o)
      caffe::SolverParameter::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in libcaffeproto.a(caffe.pb.cc.o)
      caffe::SolverState::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in libcaffeproto.a(caffe.pb.cc.o)
      caffe::ParamSpec::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in libcaffeproto.a(caffe.pb.cc.o)
      caffe::LayerParameter::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in libcaffeproto.a(caffe.pb.cc.o)
      caffe::TransformationParameter::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in libcaffeproto.a(caffe.pb.cc.o)
      ...
  "google::protobuf::internal::WireFormatLite::ReadBytes(google::protobuf::io::CodedInputStream*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)", referenced from:
      caffe::Datum::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in libcaffeproto.a(caffe.pb.cc.o)
      caffe::FillerParameter::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in libcaffeproto.a(caffe.pb.cc.o)
      caffe::NetParameter::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in libcaffeproto.a(caffe.pb.cc.o)
      caffe::SolverParameter::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in libcaffeproto.a(caffe.pb.cc.o)
      caffe::SolverState::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in libcaffeproto.a(caffe.pb.cc.o)
      caffe::NetState::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in libcaffeproto.a(caffe.pb.cc.o)
      caffe::NetStateRule::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) 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::MessageFactory*, google::protobuf::Metadata*, google::protobuf::EnumDescriptor const**, google::protobuf::ServiceDescriptor const**)", referenced from:
      caffe::protobuf_caffe_2eproto::(anonymous namespace)::protobuf_AssignDescriptors() in libcaffeproto.a(caffe.pb.cc.o)
  "google::protobuf::internal::fixed_address_empty_string", referenced from:
      caffe::LayerParameter::set_type(char const*) in infogain_loss_layer.cpp.o
      caffe::LSTMLayer<float>::FillUnrolledNet(caffe::NetParameter*) const in lstm_layer.cpp.o
      caffe::LayerParameter::set_type(char const*) in lstm_layer.cpp.o
      caffe::LayerParameter::set_name(char const*) in lstm_layer.cpp.o
      caffe::ParamSpec::set_name(char const*) in lstm_layer.cpp.o
      caffe::LSTMLayer<double>::FillUnrolledNet(caffe::NetParameter*) const in lstm_layer.cpp.o
      caffe::RecurrentLayer<float>::LayerSetUp(std::__1::vector<caffe::Blob<float>*, std::__1::allocator<caffe::Blob<float>*> > const&, std::__1::vector<caffe::Blob<float>*, std::__1::allocator<caffe::Blob<float>*> > const&) in recurrent_layer.cpp.o
      ...
  "leveldb::DB::Open(leveldb::Options const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, leveldb::DB**)", referenced from:
      caffe::db::LevelDB::Open(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, caffe::db::Mode) in db_leveldb.cpp.o
  "google::protobuf::Message::DebugString() const", referenced from:
      caffe::Net<float>::Init(caffe::NetParameter const&) in net.cpp.o
      caffe::Net<double>::Init(caffe::NetParameter const&) in net.cpp.o
      caffe::Solver<float>::Init(caffe::SolverParameter const&) in solver.cpp.o
      caffe::Solver<double>::Init(caffe::SolverParameter const&) in solver.cpp.o
  "google::protobuf::Message::GetTypeName() const", referenced from:
      vtable for caffe::BlobShape in libcaffeproto.a(caffe.pb.cc.o)
      vtable for caffe::BlobProto in libcaffeproto.a(caffe.pb.cc.o)
      vtable for caffe::BlobProtoVector in libcaffeproto.a(caffe.pb.cc.o)
      vtable for caffe::Datum in libcaffeproto.a(caffe.pb.cc.o)
      vtable for caffe::FillerParameter in libcaffeproto.a(caffe.pb.cc.o)
      vtable for caffe::NetParameter in libcaffeproto.a(caffe.pb.cc.o)
      vtable for caffe::SolverParameter in libcaffeproto.a(caffe.pb.cc.o)
      ...
  "google::protobuf::Message::SerializeToOstream(std::__1::basic_ostream<char, std::__1::char_traits<char> >*) const", referenced from:
      caffe::WriteProtoToBinaryFile(google::protobuf::Message const&, char const*) in io.cpp.o
  "google::protobuf::Message::InitializationErrorString() const", referenced from:
      vtable for caffe::BlobShape in libcaffeproto.a(caffe.pb.cc.o)
      vtable for caffe::BlobProto in libcaffeproto.a(caffe.pb.cc.o)
      vtable for caffe::BlobProtoVector in libcaffeproto.a(caffe.pb.cc.o)
      vtable for caffe::Datum in libcaffeproto.a(caffe.pb.cc.o)
      vtable for caffe::FillerParameter in libcaffeproto.a(caffe.pb.cc.o)
      vtable for caffe::NetParameter in libcaffeproto.a(caffe.pb.cc.o)
      vtable for caffe::SolverParameter 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[2]: *** [lib/libcaffe.1.0.0.dylib] Error 1
make[1]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
make: *** [all] Error 2

谢谢。

标签: caffe

解决方案


推荐阅读