Another Make OpenCV Compile Issue

589 views
Skip to first unread message

Jafaruddin Lie

unread,
Apr 18, 2018, 8:16:09 PM4/18/18
to Caffe Users
Platform: CentOS 7

Modules:
  • OpenCV 2.4.5 (default for CentOS)
  • cuda/8.0.61
  • gcc/5.0.4
  • cmake/3.10.2-gcc5
  • protobuf/latest
  • glog/latest
  • nccl/latest
Using make to compile.

I am getting the infamous 'undefined reference to cv::imencode' and 'undefined reference to vtable for cv::_InputArray'

collect2: error: ld returned 1 exit status                                                                                                             │·····················
make
: *** [.build_release/examples/cpp_classification/classification.bin] Error 1                                                                      │·····················
.build_release/lib/libcaffe.so: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'                                                      │·····················
.build_release/lib/libcaffe.so: undefined reference to `
cv::_InputArray::_InputArray(cv::Mat const&)'                                                  │·····················
.build_release/lib/libcaffe.so: undefined reference to `google::base::CheckOpMessageBuilder::NewString[abi:cxx11]()'
                                  │·····················
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > co│·····················
nst&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)'             │·····················
.build_release/lib/libcaffe.so: undefined reference to `
cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > cons│·····················
t
&, int)'                                                                                                                                              │·····················
.build_release/lib/libcaffe.so: undefined reference to `vtable for cv::_InputArray'
                                                                   │·····················
collect2
: error: ld returned 1 exit status        

I have looked at https://github.com/BVLC/caffe/issues/3700 and https://github.com/BVLC/caffe/issues/4621, but I am not using OpenCV 3, I am using OpenCV 2 that comes with CentOS 7 binary.

I am wondering if anyone can help me with this?

Antonimus

unread,
Apr 18, 2018, 11:20:46 PM4/18/18
to Caffe Users
I have a similar problem, as in your case in most of the solutions online they make reference to OpenCV 3. But I am using OpenCV 2.7 

Have you found a solution?

Jafaruddin Lie

unread,
Apr 19, 2018, 6:05:14 AM4/19/18
to Caffe Users
Hi Antonimus
I solved this issue by:
1. Upgrading to OpenCV 3 (manual install)
3. Fixing up GCC 5.4.0 Type Traits (https://github.com/UoB-HPC/BabelStream/issues/16)
4. Recompiling glog with -std=c++11 flag.

It compiles fine, but now I am running into issues when I enable Matlab.
Reply all
Reply to author
Forward
0 new messages