title: Crosscompiling with cmake for ARM with OpenCV
body: <p>I am trying to crosscompile my application, written in C++ and using OpenCV for BeagleBone ARM-based board. The target OS is Ubuntu 13.10, the host OS is Ubuntu 12.04 and I can build the app successfully on the both systems using native compiler. However, when I crosscompile using arm cross compiler from Ubuntu repository, I get an error about missing standard header file (bits/stdlib-float.h). Here is a small example to show the same problem (arm_root directory contains the target environment).</p>
  
  <p>src/cross.cpp:</p>
  
  <pre><code>#include &lt;opencv2/opencv.hpp&gt;
  
  int main()
  {
      cv::Mat m(10, 10, CV_8UC1);
      return 0;
  }
  </code></pre>
  
  <p>CMakeLists.txt:</p>
  
  <pre><code>cmake_minimum_required(VERSION 2.6)
  find_package(OpenCV REQUIRED)
  add_executable(cross src/cross.cpp)
  target_link_libraries(cross ${OpenCV_LIBS})
  </code></pre>
  
  <p>arm_toolchain.cmake (The idea is to link the app to the standard C++ library in the host crosscompiler environment, but link to the OpenCV in the target environment. I am not sure whether this is a right choice):</p>
  
  <pre><code>set(CMAKE_SYSTEM_NAME Linux)
  set(CMAKE_C_COMPILER /usr/bin/arm-linux-gnueabihf-gcc)
  set(CMAKE_CXX_COMPILER /usr/bin/arm-linux-gnueabihf-g++)
  set(CMAKE_FIND_ROOT_PATH /usr/arm-linux-gnueabihf /home/alex/arm_root)
  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
  </code></pre>
  
  <p>cmake  -DCMAKE_TOOLCHAIN_FILE=../arm_toolchain.cmake .. &amp;&amp; make:</p>
  
  <pre><code>[100%] Building CXX object CMakeFiles/cross.dir/src/cross.cpp.o
  In file included from /home/alex/arm_root/usr/include/opencv2/core/types_c.h:56:0,
                   from /home/alex/arm_root/usr/include/opencv2/core/core_c.h:47,
                   from /home/alex/arm_root/usr/include/opencv2/opencv.hpp:46,
                   from /home/alex/sandbox/cmake/cross/src/cross.cpp:1:
  /home/alex/arm_root/usr/include/stdlib.h:951:31: fatal error: bits/stdlib-float.h: No such file or directory
  compilation terminated.
  make[2]: *** [CMakeFiles/cross.dir/src/cross.cpp.o] Error 1
  make[1]: *** [CMakeFiles/cross.dir/all] Error 2
  make: *** [all] Error 2
  </code></pre>