opencv交叉编译错误

时间:2014-12-16 12:02:21

标签: linux opencv cross-compiling

root@PyImageSearch:~/practiceCode/helloWorld# cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.arm.cmake .
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/arm-linux-gnueabi-gcc
-- Check for working C compiler: /usr/bin/arm-linux-gnueabi-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/arm-linux-gnueabi-g++
-- Check for working CXX compiler: /usr/bin/arm-linux-gnueabi-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /root/practiceCode/helloWorld
root@PyImageSearch:~/practiceCode/helloWorld# make
Scanning dependencies of target helloWorld
[100%] Building CXX object CMakeFiles/helloWorld.dir/main.cpp.o
Linking CXX executable helloWorld
/usr/local/lib/libopencv_videostab.so.2.4.8: file not recognized: File format not recognized
collect2: ld returned 1 exit status
make[2]: *** [helloWorld] Error 1
make[1]: *** [CMakeFiles/helloWorld.dir/all] Error 2
make: *** [all] Error 2

为了检查库和测试编译,我写了一个简单的hello world程序。 如你所见,cmake有效,但当我使用make时,总会出现同样的错误:

  

文件无法识别!!! libopencv_videostab.so.2.4.8存在于该目录中。

这是CMakeLists.txt

cmake_minimum_required(VERSION 2.8)
project( helloWorld )
find_package( OpenCV REQUIRED )
add_executable( helloWorld main.cpp )
target_link_libraries( helloWorld ${OpenCV_LIBS} )

这是toolchain.arm.cmake文件:

SET(CMAKE_C_COMPILER /usr/bin/arm-linux-gnueabi-gcc)
SET(CMAKE_CXX_COMPILER /usr/bin/arm-linux-gnueabi-g++)
SET(CMAKE_LINKER /usr/bin/arm-linux-gnueabi-ld)
SET(CMAKE_NM /usr/bin/arm-linux-gnueabi-nm)
SET(CMAKE_OBJCOPY /usr/bin/arm--gnueabi-objcopy)
SET(CMAKE_OBJDUMP /usr/bin/arm-linux-gnueabi-objdump)
SET(CMAKE_RANLIB /usr/bin/arm-linux-gnueabi-ranlib)

任何人都可以帮助我吗?我需要使用'OpenCV'库。

0 个答案:

没有答案