KleinYuan / Caffe2-iOS

Caffe2 on iOS Real-time Demo. Test with Your Own Model and Photos.
MIT License
227 stars 45 forks source link

Apple Mach-O Linker Error #24

Closed varunlakshmanan closed 6 years ago

varunlakshmanan commented 6 years ago

I'm building for iOS, and ran into this error in Xcode when building the app:

Undefined symbols for architecture x86_64:
  "caffe2::Demangle(char const*)", referenced from:
      char const* caffe2::TypeMeta::Name<float>() in Caffe2.o
  "long caffe2::TypeMeta::Id<float>()", referenced from:
      std::__1::enable_if<std::is_fundamental<float>::value, caffe2::TypeMeta>::type caffe2::TypeMeta::Make<float>() in Caffe2.o
      bool caffe2::TypeMeta::Match<float>() const in Caffe2.o
  "caffe2::gTypeNames()", referenced from:
      caffe2::TypeMeta::name() const in Caffe2.o
  "caffe2::FLAGS_caffe2_print_blob_sizes_at_exit", referenced from:
      caffe2::Workspace::~Workspace() in Caffe2.o
  "caffe2::Workspace::PrintBlobSizes()", referenced from:
      caffe2::Workspace::~Workspace() in Caffe2.o
  "caffe2::ThreadPool::~ThreadPool()", referenced from:
      caffe2::Workspace::~Workspace() in Caffe2.o
  "caffe2::ReadProtoFromBinaryFile(char const*, google::protobuf::MessageLite*)", referenced from:
      caffe2::ReadProtoFromFile(char const*, google::protobuf::Message*) in Caffe2.o
  "typeinfo for caffe2::EnforceNotMet", referenced from:
      caffe2::run(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in Caffe2.o
      float const* caffe2::Tensor<caffe2::CPUContext>::data<float>() const in Caffe2.o
      caffe2::LoadPBFile(NSString*, caffe2::NetDef*) in Caffe2.o
      void caffe2::Tensor<caffe2::CPUContext>::ShareExternalPointer<void caffe2::Tensor<caffe2::CPUContext>::ShareExternalPointer<float>(float*, unsigned long)::'lambda'(void*)>(void*, caffe2::TypeMeta const&, unsigned long, float&&) in Caffe2.o
  "caffe2::FLAGS_caffe2_keep_on_shrink", referenced from:
      void caffe2::Tensor<caffe2::CPUContext>::Resize<std::__1::vector<int, std::__1::allocator<int> > >(std::__1::vector<int, std::__1::allocator<int> >) in Caffe2.o
  "caffe2::MessageLogger::MessageLogger(char const*, int, int)", referenced from:
      caffe2::run(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in Caffe2.o
  "caffe2::Predictor::Predictor(caffe2::NetDef const&, caffe2::NetDef const&, caffe2::Workspace*)", referenced from:
      std::__1::enable_if<!(std::is_array<caffe2::Predictor>::value), std::__1::unique_ptr<caffe2::Predictor, std::__1::default_delete<caffe2::Predictor> > >::type caffe2::make_unique<caffe2::Predictor, caffe2::NetDef&, caffe2::NetDef&>(caffe2::NetDef&&&, caffe2::NetDef&&&) in Caffe2.o
      caffe2::getPredictor(NSString*, NSString*) in Caffe2.o
  "caffe2::ReadProtoFromTextFile(char const*, google::protobuf::Message*)", referenced from:
      caffe2::ReadProtoFromFile(char const*, google::protobuf::Message*) in Caffe2.o
  "vtable for caffe2::EnforceNotMet", referenced from:
      caffe2::EnforceNotMet::~EnforceNotMet() in Caffe2.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "caffe2::EnforceNotMet::EnforceNotMet(char const*, int, char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, void const*)", referenced from:
      caffe2::run(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in Caffe2.o
      float const* caffe2::Tensor<caffe2::CPUContext>::data<float>() const in Caffe2.o
      caffe2::LoadPBFile(NSString*, caffe2::NetDef*) in Caffe2.o
      void caffe2::Tensor<caffe2::CPUContext>::ShareExternalPointer<void caffe2::Tensor<caffe2::CPUContext>::ShareExternalPointer<float>(float*, unsigned long)::'lambda'(void*)>(void*, caffe2::TypeMeta const&, unsigned long, float&&) in Caffe2.o
  "caffe2::Predictor::run(std::__1::vector<caffe2::Tensor<caffe2::CPUContext>*, std::__1::allocator<caffe2::Tensor<caffe2::CPUContext>*> > const&, std::__1::vector<caffe2::Tensor<caffe2::CPUContext>*, std::__1::allocator<caffe2::Tensor<caffe2::CPUContext>*> >*)", referenced from:
      caffe2::run(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in Caffe2.o
      -[Caffe2 predictWithImage:predictor:] in Caffe2.o
  "caffe2::NetDef::NetDef()", referenced from:
      caffe2::run(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in Caffe2.o
      caffe2::getPredictor(NSString*, NSString*) in Caffe2.o
  "caffe2::MessageLogger::~MessageLogger()", referenced from:
      caffe2::run(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in Caffe2.o
  "caffe2::NetDef::~NetDef()", referenced from:
      caffe2::run(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in Caffe2.o
      caffe2::getPredictor(NSString*, NSString*) in Caffe2.o
      caffe2::Predictor::~Predictor() in Caffe2.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

What's the issue here? I already took a look at this issue, but the answer there doesn't seem to solve my problem.