Ask Your Question
0

error cross compiling for ARM

asked 2015-07-15 10:54:46 -0500

I'm trying to cross compile opencv from source (git tag 3.0.0-rc1 or 2.4 branch, doesn't matter) on Ubuntu trusty (PC 64Bit).

I always get errors at the very beginning, when the 3rd party stuff is built.

I've created a "build" folder in platform/linux and this is my cmake command line:

cmake -DCMAKE_TOOLCHAIN_FILE=../arm-gnueabi.toolchain.cmake -DCMAKE_C_COMPILER=/usr/bin/arm-linux-gnueabihf-gcc -DCMAKE_CXX_COMPILER=/usr/bin/arm-linux-gnueabihf-g++ ../../..

While configuring, CMAKE tells about missing libs (zlib, jpeg ...) but nevertheless does not throw errors. "make" then tries to build the libraries itself, but fails when linking them. The error message is

"Linking C static library ../lib/libzlib.a Error running link command: No such file or directory".

I tried to avoid building these libraries by adding "-DZLIB_LIBRARY=..." and the like, but this does just let the build fail elsewhere with the same error message.

Building the same stuff on a native machine seems to work (I used an Odroid XU for that).

edit retag flag offensive close merge delete

Comments

It might be because it is searching for those libraires in native environment and somehow failing to get it. An ideal way should be to build 3rd party libraries on the go by giving cmake parameter -D BUI:D_<lib>=ON. I'm not sure if it includes zlib. But i have done it with TBB and it helped me. Hope it helps.

dastaan90 gravatar imagedastaan90 ( 2015-07-15 12:43:25 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-11-01 07:43:13 -0500

AlaaM gravatar image

I found a workaround:

After running cmake and generating the make files, edit opencv/opencv/platforms/linux/<your_build_dir>/CMakeFiles/3.5.1/CMakeCCompiler.cmake and replace set(CMAKE_AR "CMAKE_AR-NOTFOUND") with set(CMAKE_AR "/usr/bin/arm-linux-gnueabi-ar")

Note that setting the variable CMAKE_AR in the cmake line (CMAKE_AR="/usr/bin/arm-linux-gnueabi-ar") does not work. Seems like this sets the flag to empty.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2015-07-15 10:54:46 -0500

Seen: 1,404 times

Last updated: Nov 01 '16