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 #21

Closed radmahdi closed 6 years ago

radmahdi commented 7 years ago

Thanks for the good work. However, I am getting linking error while compiling as below. Any suggestions would be appreciated.

Showing All Issues Ld /Users/mahdi/Library/Developer/Xcode/DerivedData/caffe2-ios-fpqtinitbynmvhatqlrigymcrazv/Build/Products/Debug-iphonesimulator/caffe2-ios.app/caffe2-ios normal x86_64 cd /Users/mahdi/project/Caffe2-iOS/src/caffe2-ios export IPHONEOS_DEPLOYMENT_TARGET=10.2 export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk -L/Users/mahdi/Library/Developer/Xcode/DerivedData/caffe2-ios-fpqtinitbynmvhatqlrigymcrazv/Build/Products/Debug-iphonesimulator -L/Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios -F/Users/mahdi/Library/Developer/Xcode/DerivedData/caffe2-ios-fpqtinitbynmvhatqlrigymcrazv/Build/Products/Debug-iphonesimulator -F/Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios -filelist /Users/mahdi/Library/Developer/Xcode/DerivedData/caffe2-ios-fpqtinitbynmvhatqlrigymcrazv/Build/Intermediates/caffe2-ios.build/Debug-iphonesimulator/caffe2-ios.build/Objects-normal/x86_64/caffe2-ios.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -mios-simulator-version-min=10.2 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/mahdi/Library/Developer/Xcode/DerivedData/caffe2-ios-fpqtinitbynmvhatqlrigymcrazv/Build/Intermediates/caffe2-ios.build/Debug-iphonesimulator/caffe2-ios.build/Objects-normal/x86_64/caffe2-ios_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -stdlib=libc++ -fobjc-arc -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -add_ast_path -Xlinker /Users/mahdi/Library/Developer/Xcode/DerivedData/caffe2-ios-fpqtinitbynmvhatqlrigymcrazv/Build/Intermediates/caffe2-ios.build/Debug-iphonesimulator/caffe2-ios.build/Objects-normal/x86_64/caffe2_ios.swiftmodule -force_load caffe2-ios/libCaffe2_CPU.a -Xlinker -sectcreate -Xlinker TEXT -Xlinker entitlements -Xlinker /Users/mahdi/Library/Developer/Xcode/DerivedData/caffe2-ios-fpqtinitbynmvhatqlrigymcrazv/Build/Intermediates/caffe2-ios.build/Debug-iphonesimulator/caffe2-ios.build/caffe2-ios.app.xcent -framework AVFoundation -framework UIKit -framework Foundation -framework Accelerate -lprotobuf -lCaffe2_CPU -lstdc++ -framework opencv2 -lCAFFE2_PTHREADPOOL -lCAFFE2_NNPACK -lprotobuf-lite -Xlinker -dependency_info -Xlinker /Users/mahdi/Library/Developer/Xcode/DerivedData/caffe2-ios-fpqtinitbynmvhatqlrigymcrazv/Build/Intermediates/caffe2-ios.build/Debug-iphonesimulator/caffe2-ios.build/Objects-normal/x86_64/caffe2-ios_dependency_info.dat -o /Users/mahdi/Library/Developer/Xcode/DerivedData/caffe2-ios-fpqtinitbynmvhatqlrigymcrazv/Build/Products/Debug-iphonesimulator/caffe2-ios.app/caffe2-ios

ld: warning: ignoring file caffe2-ios/libCaffe2_CPU.a, missing required architecture x86_64 in file caffe2-ios/libCaffe2_CPU.a (3 slices) ld: warning: ignoring file /Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios/libprotobuf.a, missing required architecture x86_64 in file /Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios/libprotobuf.a (3 slices) ld: warning: ignoring file /Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios/libCaffe2_CPU.a, missing required architecture x86_64 in file /Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios/libCaffe2_CPU.a (3 slices) ld: warning: ignoring file /Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios/libCAFFE2_PTHREADPOOL.a, missing required architecture x86_64 in file /Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios/libCAFFE2_PTHREADPOOL.a (3 slices) ld: warning: ignoring file /Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios/libCAFFE2_NNPACK.a, missing required architecture x86_64 in file /Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios/libCAFFE2_NNPACK.a (3 slices) ld: warning: ignoring file /Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios/libprotobuf-lite.a, missing required architecture x86_64 in file /Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios/libprotobuf-lite.a (3 slices) Undefined symbols for architecture x86_64: "caffe2::Demangle(char const)", referenced from: char const caffe2::TypeMeta::Name() in Caffe2.o "long caffe2::TypeMeta::Id()", referenced from: std::1::enable_if<std::is_fundamental::value, caffe2::TypeMeta>::type caffe2::TypeMeta::Make() in Caffe2.o bool caffe2::TypeMeta::Match() 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::NetDef::NetDef()", referenced from: -[Caffe2 .cxx_construct] in Caffe2.o "caffe2::EnforceNotMet::EnforceNotMet(char const, int, char const, std::__1::basic_string<char, std::1::char_traits, std::1::allocator > const&, void const*)", referenced from: ReadProtoIntoNet(std::1::basic_string<char, std::1::char_traits, std::__1::allocator >, caffe2::NetDef) in Caffe2.o float const caffe2::Tensor::data() const in Caffe2.o void caffe2::Tensor::ShareExternalPointer<void caffe2::Tensor::ShareExternalPointer(float, unsigned long)::'lambda'(void)>(void*, caffe2::TypeMeta const&, unsigned long, float&&) 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::NetDef::~NetDef()", referenced from: -[Caffe2 .cxx_destruct] in Caffe2.o caffe2::Predictor::~Predictor() in Caffe2.o "caffe2::FLAGS_caffe2_max_keep_on_shrink_memory", referenced from: void caffe2::Tensor::Resize<std::1::vector<int, std::1::allocator > >(std::1::vector<int, std::1::allocator >) in Caffe2.o "google::protobuf::ShutdownProtobufLibrary()", referenced from: -[Caffe2 dealloc] in Caffe2.o "typeinfo for caffe2::EnforceNotMet", referenced from: ReadProtoIntoNet(std::1::basic_string<char, std::1::char_traits, std::1::allocator >, caffe2::NetDef) in Caffe2.o float const caffe2::Tensor::data() const in Caffe2.o void caffe2::Tensor::ShareExternalPointer<void caffe2::Tensor::ShareExternalPointer(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::Resize<std::1::vector<int, std::1::allocator > >(std::1::vector<int, std::__1::allocator >) in Caffe2.o "caffe2::Predictor::Predictor(caffe2::NetDef const&, caffe2::NetDef const&, caffe2::Workspace*)", referenced from: -[Caffe2 init:predict:error:] in Caffe2.o -[Caffe2 reloadModel:predict:error:] in Caffe2.o -[Caffe2 loadDownloadedModel:predict:error:] in Caffe2.o "google::protobuf::internal::fixed_address_empty_string", referenced from: google::protobuf::internal::GetEmptyStringAlreadyInited() in Caffe2.o "google::protobuf::Message::ParseFromFileDescriptor(int)", referenced from: ReadProtoIntoNet(std::1::basic_string<char, std::__1::char_traits, std::1::allocator >, caffe2::NetDef*) in Caffe2.o "caffe2::Predictor::run(std::1::vector<caffe2::Tensor, std::__1::allocator<caffe2::Tensor> > const&, std::1::vector<caffe2::Tensor*, std::1::allocator<caffe2::Tensor> >)", referenced from: -[Caffe2 predict:] 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)

Showing All Issues "caffe2::Demangle(char const*)", referenced from:

  char const* caffe2::TypeMeta::Name<float>() in Caffe2.o

"long caffe2::TypeMeta::Id()", 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::NetDef::NetDef()", referenced from:

  -[Caffe2 .cxx_construct] in Caffe2.o

"caffe2::EnforceNotMet::EnforceNotMet(char const, int, char const, std::1::basic_string<char, std::__1::char_traits, std::1::allocator > const&, void const*)", referenced from:

  ReadProtoIntoNet(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, caffe2::NetDef*) in Caffe2.o

  float const* caffe2::Tensor<caffe2::CPUContext>::data<float>() const 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

"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::NetDef::~NetDef()", referenced from:

  -[Caffe2 .cxx_destruct] in Caffe2.o

  caffe2::Predictor::~Predictor() in Caffe2.o

"caffe2::FLAGS_caffe2_max_keep_on_shrink_memory", 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

"google::protobuf::ShutdownProtobufLibrary()", referenced from:

  -[Caffe2 dealloc] in Caffe2.o

"typeinfo for caffe2::EnforceNotMet", referenced from:

  ReadProtoIntoNet(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, caffe2::NetDef*) in Caffe2.o

  float const* caffe2::Tensor<caffe2::CPUContext>::data<float>() const 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::Predictor::Predictor(caffe2::NetDef const&, caffe2::NetDef const&, caffe2::Workspace*)", referenced from:

  -[Caffe2 init:predict:error:] in Caffe2.o

  -[Caffe2 reloadModel:predict:error:] in Caffe2.o

  -[Caffe2 loadDownloadedModel:predict:error:] in Caffe2.o

"google::protobuf::internal::fixed_address_empty_string", referenced from:

  google::protobuf::internal::GetEmptyStringAlreadyInited() in Caffe2.o

"google::protobuf::Message::ParseFromFileDescriptor(int)", referenced from:

  ReadProtoIntoNet(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, caffe2::NetDef*) in Caffe2.o

"caffe2::Predictor::run(std::1::vector<caffe2::Tensor*, std::1::allocator<caffe2::Tensor> > const&, std::__1::vector<caffe2::Tensor, std::__1::allocator<caffe2::Tensor> >)", referenced from:

  -[Caffe2 predict:] 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)

KleinYuan commented 7 years ago

@radmahdi thanks for the feedback and which branch are you testing?

Are you testing against the updated master branch?

The caffe2 v0.8.0 added support for METAL, which broke this project before.

My last commit should fix this and force the caffe to checkout to v0.7.0 which I think is stable and should not have this issue.

Could you clarify that?

radmahdi commented 7 years ago

Thanks for clarification. I had to update submodule after checking out to v0.7.0. So it solved the problem

KleinYuan commented 6 years ago

Seems a problem solved. If occur again, please reopen.

varunlakshmanan commented 6 years ago

@radmahdi @KleinYuan What submodule did you have to update? I'm still having this error. I am testing against the master branch (which checks out 0.7.0 by default) but the problem is still there.