menpo / conda-opencv3

Automated building of OpenCV3 Python bindings
BSD 3-Clause "New" or "Revised" License
54 stars 17 forks source link

`ld not found` when linking caffe/opencv_dnn #8

Open DelightRun opened 8 years ago

DelightRun commented 8 years ago

I got this when I run conda build conda/:

  "google::protobuf::internal::WireFormatLite::ReadBytes(google::protobuf::io::CodedInputStream*, std::string*)", referenced from:
      caffe::Datum::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in caffe.pb.cc.o
  "google::protobuf::internal::StringTypeHandlerBase::Delete(std::string*)", referenced from:
      caffe::NetParameter::NetParameter() in caffe.pb.cc.o
      caffe::NetParameter::NetParameter(caffe::NetParameter const&) in caffe.pb.cc.o
      caffe::NetParameter::~NetParameter() in caffe.pb.cc.o
      caffe::SolverParameter::SolverParameter() in caffe.pb.cc.o
      caffe::SolverParameter::SolverParameter(caffe::SolverParameter const&) in caffe.pb.cc.o
      caffe::SolverParameter::~SolverParameter() in caffe.pb.cc.o
      caffe::NetState::NetState() in caffe.pb.cc.o
      ...
  "google::protobuf::DescriptorPool::FindFileByName(std::string const&) const", referenced from:
      caffe::protobuf_AssignDesc_caffe_2eproto() in 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)

I checked my protobuf lib using otool -L /usr/local/lib/libprotobuf.dylib, the output is:

/usr/local/lib/libprotobuf.dylib:
    /usr/local/opt/protobuf/lib/libprotobuf.9.dylib (compatibility version 10.0.0, current version 10.1.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)

My OS is Mac OS X 10.11.4. So what's the problem? Is some lib linked to libstdc++? How to solve this?

patricksnape commented 8 years ago

At the moment my builds try to support back to 10.7. By default, this means that OSX links to libstdc++ since libc++ wasn't shipped on 10.7 until the XCode 4.2 release. Just did a little reading and it seems that I may be OK to rebuild using libc++, just need to pass the requisite flags.