Caffe: Can't build on MacOS, undefined symbols for tools/caffe.bin

Created on 17 Feb 2016  路  2Comments  路  Source: BVLC/caffe

I have had MacPorts on my computer for quite some time, so an install with Homebrew seemed like a bad idea. After much tinkering, I have made a lot of progress with compiling from source. After building for a while, however, I get this error: (Still fails after a make clean && make all)

Any help would be much appreciated.

CXX/LD -o .build_release/tools/caffe.bin
/usr/bin/clang++ .build_release/tools/caffe.o -o .build_release/tools/caffe.bin -pthread -fPIC -DCAFFE_VERSION=1.0.0-rc3 -DGTEST_USE_OWN_TR1_TUPLE=1 -DNDEBUG -O2 -DUSE_OPENCV -DUSE_LEVELDB -DUSE_LMDB -DCPU_ONLY -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I/opt/local/include -I.build_release/src -I./src -I./include -Wall -Wno-sign-compare -lcaffe -L/usr/lib -L/usr/local/lib -L/usr/lib -L/opt/local/lib -L.build_release/lib -lglog -lgflags -lprotobuf -lboost_system -lboost_filesystem -lm -lhdf5_hl -lhdf5 -lleveldb -lsnappy -llmdb -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_imgcodecs -lboost_thread-mt -lopenblas
-Wl,-rpath,@loader_path/../lib
clang: warning: argument unused during compilation: '-pthread'
Undefined symbols for architecture x86_64:
"caffe::SignalHandler::GetActionFunction()", referenced from:
train() in caffe.o
"caffe::SignalHandler::SignalHandler(caffe::SolverAction::Enum, caffe::SolverAction::Enum)", referenced from:
train() in caffe.o
"caffe::SignalHandler::~SignalHandler()", referenced from:
train() in caffe.o
"caffe::ReadSolverParamsFromTextFileOrDie(std::__1::basic_string, std::__1::allocator > const&, caffe::SolverParameter_)", referenced from:
train() in caffe.o
"caffe::Net::Net(std::__1::basic_string, std::__1::allocator > const&, caffe::Phase, caffe::Net const_)", referenced from:
test() in caffe.o
time() in caffe.o
"caffe::Caffe::Get()", referenced from:
train() in caffe.o
test() in caffe.o
time() in caffe.o
caffe::Layer::Forward(std::__1::vectorcaffe::Blob > const&, std::__1::vectorcaffe::Blob > const&) in caffe.o
"caffe::Layer::Lock()", referenced from:
caffe::Layer::Forward(std::__1::vectorcaffe::Blob > const&, std::__1::vectorcaffe::Blob > const&) in caffe.o
"caffe::Layer::Unlock()", referenced from:
caffe::Layer::Forward(std::__1::vectorcaffe::Blob > const&, std::__1::vectorcaffe::Blob > const&) in caffe.o
"caffe::Solver::SetActionFunction(boost::function train() in caffe.o
"caffe::P2PSync::run(std::__1::vector > const&)", referenced from:
train() in caffe.o
"caffe::P2PSync::P2PSync(boost::shared_ptrcaffe::Solver_, caffe::SolverParameter const&)", referenced from:
train() in caffe.o
"caffe::P2PSync::~P2PSync()", referenced from:
train() in caffe.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/tools/caffe.bin] Error

Possibly useful info:
Mac OSX 10.10.5 Building for CPU only (my GPU is unsupported) and using OpenBlas

mac

Most helpful comment

Do check if you already have a libcaffe.so in your system library paths (maybe /usr/local/lib). If so, delete the existing libcaffe.so and build again.

All 2 comments

Do you happen to have a caffe installation from MacPorts in your /opt/local/...? Because this looks like you are trying to link against an older libcaffe.dylib than the one you compile (the older one missing the symbols mentioned in the error message). If so, then sudo port uninstall caffe should do the trick.

Do check if you already have a libcaffe.so in your system library paths (maybe /usr/local/lib). If so, delete the existing libcaffe.so and build again.

Was this page helpful?
0 / 5 - 0 ratings