Installation Issues: Undefined symbols for architecture x86_64

685 views
Skip to first unread message

Charles Prado

unread,
Nov 23, 2015, 8:51:10 AM11/23/15
to Caffe Users
Hello everyone, I'm trying to compile CAFFE but I'm having some issues. This time the problem is related to OpenCV, and says: 

Undefined symbols for architecture x86_64:

  "cv::imread(cv::String const&, int)", referenced from:

      caffe::WindowDataLayer<float>::load_batch(caffe::Batch<float>*) in window_data_layer.o

      caffe::WindowDataLayer<double>::load_batch(caffe::Batch<double>*) 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::imdecode(cv::_InputArray const&, int)", referenced from:

      caffe::DecodeDatumToCVMatNative(caffe::Datum const&) in io.o

      caffe::DecodeDatumToCVMat(caffe::Datum const&, bool) in io.o

  "cv::imencode(cv::String 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

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

I'm running OSX 10.4 and my OpenCV was installed via brew (I also have another installation of OpenCV but it's isolated). OpenCV is installed on path: /usr/local/Cellar/opencv. I already tried to edit these lines:

# Whatever else you find you need goes here.

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/local/Cellar/opencv/2.4.11_1/include

LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/local/Cellar/opencv/2.4.11_1/lib

and these:

# If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies

INCLUDE_DIRS += $(shell brew --prefix)/include

LIBRARY_DIRS += $(shell brew --prefix)/lib


...with no effect...

Any suggestions? 

Charles Prado

unread,
Nov 23, 2015, 12:04:00 PM11/23/15
to Caffe Users
Ok guys... "problem" solved... the solution is very simple... If someone have the same issue, the solution is 

# Uncomment if you're using OpenCV 3
OPENCV_VERSION := 3

uncomment this line on makefile... u.u

yes... I didn't noticed that line until now. As said here, this error is generated "[...] probably because imread was moved to opencv_imgcodecs [...]".

tmdck...@ajou.ac.kr

unread,
Jan 6, 2019, 9:36:27 PM1/6/19
to Caffe Users
omg it worked.
you literally saved my day.
thank you!!

2015년 11월 24일 화요일 오전 2시 4분 0초 UTC+9, Charles Prado 님의 말:
Reply all
Reply to author
Forward
0 new messages