opencv issue
revikiran1991 opened this issue · 1 comments
Please use the caffe-users list for usage, installation, or modeling questions, or other requests for help.
Do not post such requests to Issues. Doing so interferes with the development of Caffe.
Please read the guidelines for contributing before submitting this issue.
Issue summary
Steps to reproduce
If you are having difficulty building Caffe or training a model, please ask the caffe-users mailing list. If you are reporting a build error that seems to be due to a bug in Caffe, please attach your build configuration (either Makefile.config or CMakeCache.txt) and the output of the make (or cmake) command.
-- ******************* Caffe Configuration Summary *******************
-- General:
-- Version : 1.0.0-rc3
-- Git : abcf30d-dirty
-- System : Linux
-- C++ compiler : /bin/c++
-- Release CXX flags : -O3 -DNDEBUG -fPIC -Wall -Wno-sign-compare -Wno-uninitialized
-- Debug CXX flags : -g -fPIC -Wall -Wno-sign-compare -Wno-uninitialized
-- Build type : Release
-- BUILD_SHARED_LIBS : ON
-- BUILD_python : ON
-- BUILD_matlab : OFF
-- BUILD_docs : ON
-- CPU_ONLY : OFF
-- USE_OPENCV : ON
-- USE_LEVELDB : ON
-- USE_LMDB : ON
-- ALLOW_LMDB_NOLOCK : OFF
-- Dependencies:
-- BLAS : Yes (Open)
-- Boost : Yes (ver. 1.53)
-- glog : Yes
-- gflags : Yes
-- protobuf : Yes (ver. 2.5.0)
-- lmdb : Yes (ver. 0.9.18)
-- LevelDB : Yes (ver. 1.12)
-- Snappy : Yes (ver. 1.1.0)
-- OpenCV : Yes (ver. )
-- CUDA : Yes (ver. 8.0)
-- NVIDIA CUDA:
-- Target GPU(s) : Auto
-- GPU arch(s) : sm_37
-- cuDNN : Not found
-- Python:
-- Interpreter : /bin/python2.7 (ver. 2.7.5)
-- Libraries : /usr/lib64/libpython2.7.so (ver 2.7.5)
-- NumPy : /home/bramin/.local/lib/python2.7/site-packages/numpy/core/include (ver 1.7.1)
-- Documentaion:
-- Doxygen : /bin/doxygen (1.8.5)
-- config_file : /scratch/bramin/caffe/SegNet/caffe-segnet-cudnn5/.Doxyfile
-- Install:
-- Install path : /scratch/bramin/caffe/SegNet/caffe-segnet-cudnn5/build/install
-- Configuring done
I am trying to build this using cmake and I have installed opencv 3.1.0 in my .local directory. I have given the OpenCV_DIR in Cmakelist as follows:
set(OpenCV_INCLUDE_DIRS "/home/bramin/.local/lib/opencv/include")
set(OpenCV_LIBS "/home/bramin/.local/lib/opencv/lib/libopencv_core.so")
set(OpenCV_CONFIG_PATH "/home/bramin/.local/lib/opencv/lib/pkgconfig/opencv.pc")
---[ OpenCV
if(USE_OPENCV)
set(OpenCV_DIR "/home/bramin/.local/lib/opencv/")
include_directories(SYSTEM ${OpenCV_INCLUDE_DIRS})
list(APPEND Caffe_LINKER_LIBS ${OpenCV_LIBS})
message(STATUS "OpenCV found (${OpenCV_CONFIG_PATH})")
add_definitions(-DUSE_OPENCV)
endif()
But while doing make all I am getting following errors:
[ 97%] [ 98%] Building CXX object tools/CMakeFiles/extract_features.dir/extract_features.cpp.o
Building CXX object tools/CMakeFiles/device_query.dir/device_query.cpp.o
Linking CXX executable cifar10/convert_cifar_data
Linking CXX executable device_query
Linking CXX executable siamese/convert_mnist_siamese_data
Linking CXX executable mnist/convert_mnist_data
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imread(cv::String const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator >&, std::vector<int, std::allocator > const&)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imdecode(cv::_InputArray const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::resize(cv::_InputArray const&, cv::OutputArray const&, cv::Size, double, double, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [examples/cifar10/convert_cifar_data] Error 1
make[1]: *** [examples/CMakeFiles/convert_cifar_data.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Linking CXX executable compute_image_mean
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imread(cv::String const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator >&, std::vector<int, std::allocator > const&)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imdecode(cv::_InputArray const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::resize(cv::_InputArray const&, cv::OutputArray const&, cv::Size, double, double, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [examples/siamese/convert_mnist_siamese_data] Error 1
make[1]: *** [examples/CMakeFiles/convert_mnist_siamese_data.dir/all] Error 2
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imread(cv::String const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator >&, std::vector<int, std::allocator > const&)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imdecode(cv::_InputArray const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::resize(cv::_InputArray const&, cv::OutputArray const&, cv::Size, double, double, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [examples/mnist/convert_mnist_data] Error 1
make[1]: *** [examples/CMakeFiles/convert_mnist_data.dir/all] Error 2
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imread(cv::String const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator >&, std::vector<int, std::allocator > const&)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imdecode(cv::_InputArray const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::resize(cv::_InputArray const&, cv::OutputArray const&, cv::Size, double, double, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/compute_image_mean] Error 1
make[1]: *** [tools/CMakeFiles/compute_image_mean.dir/all] Error 2
Linking CXX executable convert_imageset
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imread(cv::String const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator >&, std::vector<int, std::allocator > const&)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imdecode(cv::_InputArray const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::resize(cv::_InputArray const&, cv::OutputArray const&, cv::Size, double, double, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/convert_imageset] Error 1
make[1]: *** [tools/CMakeFiles/convert_imageset.dir/all] Error 2
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imread(cv::String const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator >&, std::vector<int, std::allocator > const&)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imdecode(cv::_InputArray const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::resize(cv::_InputArray const&, cv::OutputArray const&, cv::Size, double, double, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/device_query] Error 1
make[1]: *** [tools/CMakeFiles/device_query.dir/all] Error 2
[ 98%] [ 98%] [100%] Building CXX object tools/CMakeFiles/caffe.bin.dir/caffe.cpp.o
Building CXX object examples/CMakeFiles/test_segmentation.dir/SegNet_with_C++/test_segmentation.cpp.o
Building CXX object tools/CMakeFiles/test_net.dir/test_net.cpp.o
Linking CXX executable upgrade_solver_proto_text
Linking CXX executable train_net
Linking CXX executable net_speed_benchmark
Linking CXX executable upgrade_net_proto_text
Linking CXX executable upgrade_net_proto_binary
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imread(cv::String const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator >&, std::vector<int, std::allocator > const&)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imdecode(cv::_InputArray const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::resize(cv::_InputArray const&, cv::OutputArray const&, cv::Size, double, double, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/upgrade_solver_proto_text] Error 1
make[1]: *** [tools/CMakeFiles/upgrade_solver_proto_text.dir/all] Error 2
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imread(cv::String const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator >&, std::vector<int, std::allocator > const&)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imdecode(cv::_InputArray const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::resize(cv::_InputArray const&, cv::OutputArray const&, cv::Size, double, double, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/net_speed_benchmark] Error 1
make[1]: *** [tools/CMakeFiles/net_speed_benchmark.dir/all] Error 2
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imread(cv::String const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator >&, std::vector<int, std::allocator > const&)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imdecode(cv::_InputArray const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::resize(cv::_InputArray const&, cv::OutputArray const&, cv::Size, double, double, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/train_net] Error 1
make[1]: *** [tools/CMakeFiles/train_net.dir/all] Error 2
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imread(cv::String const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator >&, std::vector<int, std::allocator > const&)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imdecode(cv::_InputArray const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::resize(cv::_InputArray const&, cv::OutputArray const&, cv::Size, double, double, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/upgrade_net_proto_text] Error 1
make[1]: *** [tools/CMakeFiles/upgrade_net_proto_text.dir/all] Error 2
Linking CXX executable finetune_net
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imread(cv::String const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator >&, std::vector<int, std::allocator > const&)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imdecode(cv::_InputArray const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::resize(cv::_InputArray const&, cv::OutputArray const&, cv::Size, double, double, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/upgrade_net_proto_binary] Error 1
make[1]: *** [tools/CMakeFiles/upgrade_net_proto_binary.dir/all] Error 2
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imread(cv::String const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator >&, std::vector<int, std::allocator > const&)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imdecode(cv::_InputArray const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::resize(cv::_InputArray const&, cv::OutputArray const&, cv::Size, double, double, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/finetune_net] Error 1
make[1]: *** [tools/CMakeFiles/finetune_net.dir/all] Error 2
Linking CXX executable extract_features
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imread(cv::String const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator >&, std::vector<int, std::allocator > const&)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imdecode(cv::_InputArray const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::resize(cv::_InputArray const&, cv::OutputArray const&, cv::Size, double, double, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/extract_features] Error 1
make[1]: *** [tools/CMakeFiles/extract_features.dir/all] Error 2
Linking CXX executable cpp_classification/classification
CMakeFiles/classification.dir/cpp_classification/classification.cpp.o: In function Classifier::Preprocess(cv::Mat const&, std::vector<cv::Mat, std::allocator<cv::Mat> >*)': classification.cpp:(.text+0x26a): undefined reference to
cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
classification.cpp:(.text+0x3bc): undefined reference to cv::resize(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int)' classification.cpp:(.text+0xa47): undefined reference to
cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
classification.cpp:(.text+0xca5): undefined reference to cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' classification.cpp:(.text+0xd1e): undefined reference to
cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
CMakeFiles/classification.dir/cpp_classification/classification.cpp.o: In function main': classification.cpp:(.text.startup+0x1ef): undefined reference to
cv::imread(cv::String const&, int)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::imdecode(cv::_InputArray const&, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [examples/cpp_classification/classification] Error 1
make[1]: *** [examples/CMakeFiles/classification.dir/all] Error 2
Linking CXX executable test_net
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imread(cv::String const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator >&, std::vector<int, std::allocator > const&)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imdecode(cv::_InputArray const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::resize(cv::_InputArray const&, cv::OutputArray const&, cv::Size, double, double, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/test_net] Error 1
make[1]: *** [tools/CMakeFiles/test_net.dir/all] Error 2
Linking CXX executable SegNet_with_C++/test_segmentation
CMakeFiles/test_segmentation.dir/SegNet_with_C++/test_segmentation.cpp.o: In function Classifier::Preprocess(cv::Mat const&, std::vector<cv::Mat, std::allocator<cv::Mat> >*)': test_segmentation.cpp:(.text+0x127): undefined reference to
cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
test_segmentation.cpp:(.text+0x260): undefined reference to cv::resize(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int)' test_segmentation.cpp:(.text+0x716): undefined reference to
cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
test_segmentation.cpp:(.text+0x955): undefined reference to cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' test_segmentation.cpp:(.text+0x9ce): undefined reference to
cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
CMakeFiles/test_segmentation.dir/SegNet_with_C++/test_segmentation.cpp.o: In function Classifier::Visualization(caffe::Blob<float>*, std::string)': test_segmentation.cpp:(.text+0x161a): undefined reference to
cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
test_segmentation.cpp:(.text+0x16fe): undefined reference to cv::imread(cv::String const&, int)' test_segmentation.cpp:(.text+0x18b1): undefined reference to
cv::imshow(cv::String const&, cv::_InputArray const&)'
test_segmentation.cpp:(.text+0x18c0): undefined reference to cv::waitKey(int)' CMakeFiles/test_segmentation.dir/SegNet_with_C++/test_segmentation.cpp.o: In function
main':
test_segmentation.cpp:(.text.startup+0x157): undefined reference to cv::imread(cv::String const&, int)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator >&, std::vector<int, std::allocator > const&)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imdecode(cv::_InputArray const&, int)' collect2: error: ld returned 1 exit status make[2]: *** [examples/SegNet_with_C++/test_segmentation] Error 1 make[1]: *** [examples/CMakeFiles/test_segmentation.dir/all] Error 2 Linking CXX executable caffe ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::imread(cv::String const&, int)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)' ../lib/libcaffe.so.1.0.0-rc3: undefined reference to
cv::imdecode(cv::_InputArray const&, int)'
../lib/libcaffe.so.1.0.0-rc3: undefined reference to `cv::resize(cv::_InputArray const&, cv::OutputArray const&, cv::Size, double, double, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/caffe] Error 1
make[1]: *** [tools/CMakeFiles/caffe.bin.dir/all] Error 2
Linking CXX shared library ../lib/_caffe.so
Creating symlink /scratch/bramin/caffe/SegNet/caffe-segnet-cudnn5/python/caffe/_caffe.so -> /scratch/bramin/caffe/SegNet/caffe-segnet-cudnn5/build/lib/_caffe.so
[100%] Built target pycaffe
make: *** [all] Error 2
Please help me solve the problem.
If you havent solved the problem yet, try setting OPENCV_VERSION to 3 and uncommenting USE_PKG_CONFIG in the Makefile.config followed by make all.