3
votes

I am following this site to compile OpenCV for ARM.

It could not find my compiler so i hardcoded it into cmake file

find_program(CMAKE_C_COMPILER NAMES arm-linux-gnueabi-gcc-4.7) find_program(CMAKE_CXX_COMPILER NAMES arm-linux-gnueabi-g++-4.7) set(ARM_LINUX_SYSROOT /usr/arm-linux-gnueabi CACHE PATH "ARM cross compilation system root")

It compiles to aproximately 50% and then throws the following error:

Linking CXX shared library ../../lib/libopencv_viz.so /usr/lib/libvtkCharts.so.5.8.0: file not recognized: File format not recognized collect2: error: ld returned 1 exit status

I am not every experienced in cross compilation (or straight compilation for the matter). How do i fix this?

2
You don't need to hardwire the compiler in your CMakeLists.txt. You can pass it to cmake by -DCMAKE_C_COMPILER=.. and so on. - usr1234567

2 Answers

3
votes

I think it is a mismatch between libopencv_viz and libvtkCharts. Some of your 3rdparty libs are built for another platform. These libraries themselves must be recompiled from source to match the details (ABI, dynamic system library dependencies, etc) of the system on which they are intended to be used.

-1
votes

Compiling OpenCV 2.4.10 worked for me. I did not have any preferred version. If you want to compile v3.0 see @Kornel's answer, that suggests to leave viz library out of compilation.

Use this command to checkout v2.4.10

git checkout 2.4.10