Cross Compilation of opencv

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cross Compilation of opencv

6,086 Views
bandarulavanya
Contributor V

Hi All,

I need to cross compile opencv for my application. It's compiling properly with arm-fsl-linux-gnueabi, arm-linux but i need for "arm-poky-linux-gnueabi" need to use with yocto setup.

But i am getting following errors even with yocto setup or individual if i am using arm-poky-linux-gnueabi , If any one knows please help me to sort it out.

Log attached below:

divya@FSETBLR1LX038:~/opencv/OPENCV/new/bui_lav$ cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake ../opencv-2.4.9
-- The CXX compiler identification is GNU 4.9.1
-- The C compiler identification is GNU 4.9.1
-- Check for working CXX compiler: /opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++
-- Check for working CXX compiler: /opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ -- broken
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake:54 (message):
  The C++ compiler
  "/opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++"
  is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: /home/divya/opencv/OPENCV/new/bui_lav/CMakeFiles/CMakeTmp

 

  Run Build Command:/usr/bin/make "cmTryCompileExec192489027/fast"

  /usr/bin/make -f CMakeFiles/cmTryCompileExec192489027.dir/build.make
  CMakeFiles/cmTryCompileExec192489027.dir/build

  make[1]: Entering directory
  `/home/divya/opencv/OPENCV/new/bui_lav/CMakeFiles/CMakeTmp'

  /usr/bin/cmake -E cmake_progress_report
  /home/divya/opencv/OPENCV/new/bui_lav/CMakeFiles/CMakeTmp/CMakeFiles 1

  Building CXX object
  CMakeFiles/cmTryCompileExec192489027.dir/testCXXCompiler.cxx.o

 
  /opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++
  -o CMakeFiles/cmTryCompileExec192489027.dir/testCXXCompiler.cxx.o -c
  /home/divya/opencv/OPENCV/new/bui_lav/CMakeFiles/CMakeTmp/testCXXCompiler.cxx


  Linking CXX executable cmTryCompileExec192489027

  /usr/bin/cmake -E cmake_link_script
  CMakeFiles/cmTryCompileExec192489027.dir/link.txt --verbose=1

 
  /opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++
  CMakeFiles/cmTryCompileExec192489027.dir/testCXXCompiler.cxx.o -o
  cmTryCompileExec192489027 -rdynamic

 
  /opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.1/ld:
  error: cmTryCompileExec192489027 uses VFP register arguments,
  CMakeFiles/cmTryCompileExec192489027.dir/testCXXCompiler.cxx.o does not

 
  /opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.1/ld:
  failed to merge target specific data of file
  CMakeFiles/cmTryCompileExec192489027.dir/testCXXCompiler.cxx.o

  collect2: error: ld returned 1 exit status

  make[1]: *** [cmTryCompileExec192489027] Error 1

  make[1]: Leaving directory
  `/home/divya/opencv/OPENCV/new/bui_lav/CMakeFiles/CMakeTmp'

  make: *** [cmTryCompileExec192489027/fast] Error 2

 

 

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:56 (project)


-- Configuring incomplete, errors occurred!
See also "/home/divya/opencv/OPENCV/new/bui_lav/CMakeFiles/CMakeOutput.log".
See also "/home/divya/opencv/OPENCV/new/bui_lav/CMakeFiles/CMakeError.log".
divya@FSETBLR1LX038:~/opencv/OPENCV/new/bui_lav$

NOTE:

the command  for configure:

cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake ../opencv-2.4.9

toochain.cmake  contains:

----------------------------------------------------

set( CMAKE_SYSTEM_NAME Linux )
set( CMAKE_SYSTEM_PROCESSOR arm )
set( CMAKE_C_COMPILER arm-poky-linux-gnueabi-gcc )
set( CMAKE_CXX_COMPILER arm-poky-linux-gnueabi-g++ )

Thanks & Regards,

Lavanya

Labels (1)
Tags (1)
0 Kudos
Reply
2 Replies

4,279 Views
sandip_gokani
Contributor I

Hi Bandaru,

In my case, it is compiling properly with "arm-poky-linux-gnueabi", but it gives same error with "arm-fsl-linux-gnueabi".

Error:

cmake: /usr/local/lib/libcurl.so.4: no version information available (required by cmake)
-- The CXX compiler identification is unknown
-- The C compiler identification is unknown
-- Check for working CXX compiler: /opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-fsl-linux-gnueabi-g++
-- Check for working CXX compiler: /opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-fsl-linux-gnueabi-g++ -- broken
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake:54 (message):
  The C++ compiler
  "/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-fsl-linux-gnueabi-g++"
  is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: /home/sandip/HirenSir_Opencv/opencv_different_toolchain/opencv-2.4.9/build/CMakeFiles/CMakeTmp

 

  Run Build Command:/usr/bin/make "cmTryCompileExec3834116465/fast"

  /usr/bin/make -f CMakeFiles/cmTryCompileExec3834116465.dir/build.make
  CMakeFiles/cmTryCompileExec3834116465.dir/build

  make[1]: Entering directory
  `/home/sandip/HirenSir_Opencv/opencv_different_toolchain/opencv-2.4.9/build/CMakeFiles/CMakeTmp'


  /usr/bin/cmake -E cmake_progress_report
  /home/sandip/HirenSir_Opencv/opencv_different_toolchain/opencv-2.4.9/build/CMakeFiles/CMakeTmp/CMakeFiles
  1

  /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information
  available (required by /usr/bin/cmake)

  Building CXX object
  CMakeFiles/cmTryCompileExec3834116465.dir/testCXXCompiler.cxx.o

 
  /opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-fsl-linux-gnueabi-g++
  -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a7
  --sysroot=/opt/freescale/ltib -fpermissive -o
  CMakeFiles/cmTryCompileExec3834116465.dir/testCXXCompiler.cxx.o -c
  /home/sandip/HirenSir_Opencv/opencv_different_toolchain/opencv-2.4.9/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx


  cc1plus: error: bad value (cortex-a7) for -mtune switch

  make[1]: ***
  [CMakeFiles/cmTryCompileExec3834116465.dir/testCXXCompiler.cxx.o] Error 1

  make[1]: Leaving directory
  `/home/sandip/HirenSir_Opencv/opencv_different_toolchain/opencv-2.4.9/build/CMakeFiles/CMakeTmp'


  make: *** [cmTryCompileExec3834116465/fast] Error 2

 

 

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:56 (project)


-- Configuring incomplete, errors occurred!

Can you help me on this? Can you send me / attavched here,  a Cmake file?

0 Kudos
Reply

4,279 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hi Bandaru

It looks like the issue is on Cmake, , however apparently there was a change related to C++11 standard and you need to manually edit CMakeLists.txt to change some flag as-std=c++* to -std=gnu++* or CMAKE_C_FLAGS "-mfloat-abi=hard"  when compiling any library. I suggested to try latest 4.1.15_2.0.0 BSP that support Gcc 5.3.0 toolchain.

Hope this helps

0 Kudos
Reply