Caffe: MAC OS X 10.10:make all ,issue:ld: symbol(s) not found for architecture x86_64

Created on 3 Mar 2015  ·  3Comments  ·  Source: BVLC/caffe

the same issue to the website:https://github.com/BVLC/caffe/issues/1725.And my caffe-master is the lasted .My OS is MAC OSX 10.10.and follow the installed guide document.but there is a problem about "ld: symbol(s) not found for architecture x86_64"。and the information is as the follow:
clang: warning: argument unused during compilation: '-pthread'
Undefined symbols for architecture x86_64:
"cv::imread(std::string const&, int)", referenced from:
caffe::WindowDataLayer::InternalThreadEntry() in window_data_layer.o
caffe::WindowDataLayer::InternalThreadEntry() in window_data_layer.o
caffe::ReadImageToCVMat(std::string const&, int, int, bool) in io.o
"cv::imencode(std::string const&, cv::_InputArray const&, std::vector >&, std::vector > const&)", referenced from:
caffe::ReadImageToDatum(std::string const&, int, int, int, bool, std::string const&, caffe::Datum_) in io.o
"leveldb::DB::Open(leveldb::Options const&, std::string const&, leveldb::DB__)", referenced from:
caffe::db::LevelDB::Open(std::string const&, caffe::db::Mode) in db.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
What should I do could solve the issue?

Most helpful comment

I am also experiencing this issue, on OS X 10.10 with any version of protobuf (on current master).
In my environment, libstdc++ was NOT used at all for building anything, including opencv, glog, protobuf, and so on.

When doing make on CAFFE_ROOT, I get the same error as you; but using cmake (cd build && cmake .. && make) it works fine (I don't know why make on the root would fail while with cmake does not).

I am doubtful that the ordering of library linkings is correct (i.e. LDFLAG), since the following workaround which places libraries the unresolved symbols in front, is working:

$ LDFLAGS="`pkg-config --libs protobuf` `pkg-config --libs opencv`" make all

Additionally, in similar way, the following would be a workaround leading me to successfully matlab bindings (to build matcaffe) Never mind. The correct way to build matcaffe is using cmake (cd build && cmake .. -DBUILD_matlab=ON).

I hope I can further investigate into this issue afterwards as well.

All 3 comments

This thread might help you: https://groups.google.com/forum/#!topic/caffe-users/G7gj03A-JPw

I am also experiencing this issue, on OS X 10.10 with any version of protobuf (on current master).
In my environment, libstdc++ was NOT used at all for building anything, including opencv, glog, protobuf, and so on.

When doing make on CAFFE_ROOT, I get the same error as you; but using cmake (cd build && cmake .. && make) it works fine (I don't know why make on the root would fail while with cmake does not).

I am doubtful that the ordering of library linkings is correct (i.e. LDFLAG), since the following workaround which places libraries the unresolved symbols in front, is working:

$ LDFLAGS="`pkg-config --libs protobuf` `pkg-config --libs opencv`" make all

Additionally, in similar way, the following would be a workaround leading me to successfully matlab bindings (to build matcaffe) Never mind. The correct way to build matcaffe is using cmake (cd build && cmake .. -DBUILD_matlab=ON).

I hope I can further investigate into this issue afterwards as well.

Thanks your words.But after that I did follow you ,there is the same error here.Could u tell me the detail step by step?And I type the line"$ DFLAGS="pkg-config --libs protobuf pkg-config --libs opencv" make all".and there is a error as :
-bash: -L/usr/local/Cellar/protobuf/2.6.1/lib: No such file or directory
But I have the file in this directory.
Is that mean my protobuf is not installed successful?
What should I do?

Was this page helpful?
0 / 5 - 0 ratings