# Cross-compile OpenCV

Hi!

I am trying to cross-compile opencv on a Gumstix board. I followed the tutorial at: docs.opencv.org/doc/tutorials/introduction/crosscompilation/arm_crosscompile_with_cmake.html.

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&)':
/usr/lib/libopencv_highgui.a(grfmt_bmp.cpp.o): In function cv::BmpDecoder::readData(cv::Mat&)':
/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 close merge delete

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..