Matcaffe Installation Error

1,333 views
Skip to first unread message

Srujana Gattupalli

unread,
Aug 31, 2015, 8:25:41 PM8/31/15
to Caffe Users
Hi,
I am trying to make matcaffe on OS X 10.10 Yosemite without CUDA. I have installed all dependencies with libstdc++ but I am still getting this error:

sudo sudo make all matcaffe


LD -o .build_release/lib/libcaffe.so

clang: warning: argument unused during compilation: '-pthread'

Undefined symbols for architecture x86_64:

  "cv::imread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)", referenced from:

      caffe::WindowDataLayer<float>::InternalThreadEntry() in window_data_layer.o

      caffe::WindowDataLayer<double>::InternalThreadEntry() in window_data_layer.o

      caffe::ReadImageToCVMat(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, int, bool) in io.o

  "cv::imencode(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cv::_InputArray const&, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >&, std::__1::vector<int, std::__1::allocator<int> > const&)", referenced from:

      caffe::ReadImageToDatum(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, int, int, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, caffe::Datum*) in io.o

  "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.o

      caffe::DataLayer<float>::InternalThreadEntry() in data_layer.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.o

      caffe::DataLayer<double>::InternalThreadEntry() in data_layer.o

      caffe::Net<float>::Forward(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, float*) in net.o

      caffe::Net<double>::Forward(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, double*) in net.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_AddDesc_caffe_2eproto() in caffe.pb.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::SerializeWithCachedSizesToArray(unsigned char*) const in caffe.pb.o

      caffe::FillerParameter::SerializeWithCachedSizesToArray(unsigned char*) const in caffe.pb.o

      caffe::NetParameter::SerializeWithCachedSizesToArray(unsigned char*) const in caffe.pb.o

      caffe::SolverParameter::SerializeWithCachedSizesToArray(unsigned char*) const in caffe.pb.o

      caffe::SolverState::SerializeWithCachedSizesToArray(unsigned char*) const in caffe.pb.o

      caffe::NetState::SerializeWithCachedSizesToArray(unsigned char*) const in caffe.pb.o

      caffe::NetStateRule::SerializeWithCachedSizesToArray(unsigned char*) const in caffe.pb.o

      ...

  "google::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)", referenced from:

      caffe::FillerParameter::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in caffe.pb.o

      caffe::NetParameter::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in caffe.pb.o

      caffe::SolverParameter::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in caffe.pb.o

      caffe::SolverState::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in caffe.pb.o

      caffe::NetState::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in caffe.pb.o

      caffe::NetStateRule::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in caffe.pb.o

      caffe::ParamSpec::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in caffe.pb.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 caffe.pb.o

      caffe::SolverParameter::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in caffe.pb.o

      caffe::NetState::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in caffe.pb.o

      caffe::NetStateRule::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in caffe.pb.o

      caffe::LayerParameter::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in caffe.pb.o

      caffe::V1LayerParameter::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in caffe.pb.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 caffe.pb.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 caffe.pb.o

      caffe::NetParameter::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in caffe.pb.o

      caffe::SolverParameter::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in caffe.pb.o

      caffe::SolverState::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in caffe.pb.o

      caffe::ParamSpec::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in caffe.pb.o

      caffe::LayerParameter::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in caffe.pb.o

      caffe::TransformationParameter::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in caffe.pb.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 caffe.pb.o

  "google::protobuf::internal::StringTypeHandlerBase::Delete(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)", referenced from:

      caffe::NetParameter::NetParameter() in caffe.pb.o

      caffe::NetParameter::NetParameter(caffe::NetParameter const&) in caffe.pb.o

      caffe::NetParameter::~NetParameter() in caffe.pb.o

      caffe::SolverParameter::SolverParameter() in caffe.pb.o

      caffe::SolverParameter::SolverParameter(caffe::SolverParameter const&) in caffe.pb.o

      caffe::SolverParameter::~SolverParameter() in caffe.pb.o

      caffe::NetState::NetState() in caffe.pb.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.o

  "google::protobuf::MessageLite::SerializeToString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) const", referenced from:

      caffe::Net<float>::Forward(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, float*) in net.o

      caffe::Net<double>::Forward(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, double*) in net.o

  "google::protobuf::DescriptorPool::FindFileByName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const", referenced from:

      caffe::protobuf_AssignDesc_caffe_2eproto() in caffe.pb.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.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: *** [.build_release/lib/libcaffe.so] Error 1


Please help!!

Ronghang Hu

unread,
Sep 1, 2015, 1:03:26 AM9/1/15
to Caffe Users
It seems that you have unresolved opencv and protobuf libraries.

One potential reason, which may seem crazy, is as follows:

Recent versions of MATLAB (e.g. R2015a) is redistributing its own opencv and protobuf libraries.

If you find files such as libopencv_core.dylib or libprotobuf.dylib in /Applications/MATLAB_R2015a.app/bin/maci64, then it is the case.

And took me 3 days to figure this out when installing matcaffe on my macbook...

Ronghang Hu

unread,
Sep 1, 2015, 1:08:21 AM9/1/15
to Caffe Users
t seems that you have unresolved opencv and protobuf libraries. One potential reason, which may seem crazy, is as follows:

Recent versions of MATLAB (take R2015a as an example) is redistributing its own opencv and protobuf libraries. So when compiling matcaffe, Matlab mex tries to link its own libraries instead of the ones you installed, and causes the link error you got. If you find files such as libopencv_core.dylib or libprotobuf.dylib in /Applications/MATLAB_R2015a.app/bin/maci64, then it is the case. What's worse is that Matlab mex always adds its own directory to the beginning of compiler library path (And took me 3 days to figure this out when installing matcaffe on my macbook...)

A simple workaround will be to remove or rename libopencv_* and libprotobuf* in /Applications/MATLAB_R2015a.app/bin/maci64 (this is what I did). However, this is likely to break Matlab's own toolboxes such as computer vision toolbox.

On Monday, August 31, 2015 at 5:25:41 PM UTC-7, Srujana Gattupalli wrote:

Ronghang Hu

unread,
Sep 1, 2015, 1:11:30 AM9/1/15
to Caffe Users
Also, it is more preferable to install dependencies with libc++ instead of libstdc++.


On Monday, August 31, 2015 at 5:25:41 PM UTC-7, Srujana Gattupalli wrote:

Srujana Gattupalli

unread,
Sep 2, 2015, 4:30:32 PM9/2/15
to Caffe Users
Thanks!! I have compiled with libstdc++ as http://caffe.berkeleyvision.org/install_osx.html shows that 10.10 without CUDA should follow those steps. I am using Matlab 2013a. Yes I can Matlab has its own opencv and protobuf libraries. I have renamed them. I did make clean and then make all. It still shows the same error. Any Suggestions?

Srujana Gattupalli

unread,
Sep 2, 2015, 9:30:17 PM9/2/15
to Caffe Users
I also heard that clan supports libc++ by default for os x version 10.10. So I tried to set OS_DEPLOYMENT_VERSION to 10.8. It still shows same error. 
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
Message has been deleted
0 new messages