Cross-compile OpenCV

asked 2014-05-16 09:05:59 -0500

mdtux gravatar image

updated 2014-05-19 03:53:01 -0500


I am trying to cross-compile opencv on a Gumstix board. I followed the tutorial at:

First thing to improve the guide: it is my understanding that it must be used static linking for the cross-compiling to work properly. I solved this using: -DBUILD_SHARED_LIBS=OFF. If I am correct would be helpful to mention it.

However, this is not the only problem. The compilation finishes without errors but when I try to compile a simple example I get a lot of undefined reference (I post here just a few lines):

root@overo:~# g++ opencvtest.cpp -L$(pkg-config --libs opencv)
/usr/lib/libopencv_highgui.a(grfmt_sunras.cpp.o): In function `cv::SunRasterDecoder::readData(cv::Mat&)':
grfmt_sunras.cpp:(.text._ZN2cv16SunRasterDecoder8readDataERNS_3MatE+0x158): undefined reference to `__gnu_thumb1_case_shi'
/usr/lib/libopencv_highgui.a(grfmt_bmp.cpp.o): In function `cv::BmpDecoder::readData(cv::Mat&)':
grfmt_bmp.cpp:(.text._ZN2cv10BmpDecoder8readDataERNS_3MatE+0x19a): undefined reference to `__gnu_thumb1_case_shi'
/usr/lib/libopencv_highgui.a(utils.cpp.o): In function `cvConvertImage':
utils.cpp:(.text.cvConvertImage+0x146): undefined reference to `__gnu_thumb1_case_shi'
/usr/share/OpenCV/3rdparty/lib/libIlmImf.a(IexThrowErrnoExc.cpp.o): In function `Iex::throwErrnoExc(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)':

Do you know why I get these errors?

edit retag flag offensive close merge delete


btw, isn't it lacking the backticks around the pkg-config part ?

berak gravatar imageberak ( 2014-05-19 04:04:42 -0500 )edit

I am not sure about that but pkg-config --libs opencv yields same outcome. I also tried providing the library paths manually to no avail..

mdtux gravatar imagemdtux ( 2014-05-19 04:50:18 -0500 )edit

the pkg-config command above is with the backticks..

mdtux gravatar imagemdtux ( 2014-05-19 04:52:38 -0500 )edit