文件名称:opencv移植到arm, 包含cmake包
文件大小:22.62MB
文件格式:GZ
更新时间:2016-08-13 04:40:32
opencv arm cmake
opencv2.4.4移植到ARM
一、编译环境及库文件
linux环境:ubuntu 11.10
交叉编译:4.6.1
opencv: opencv-2.4.4
cmake: cmake-2.8.1-Linux-i386.tar.gz
二、opencv-2.4.4的移植过程
解压cmake-2.8.1-Linux-i386.tar.gz到/usr/local/ cmake-2.8.1
#export PATH= /usr/local/ cmake-2.8.1/bin:$PATH
用到的主要目录说明:
交叉编译工具链所在目录 /usr/local/arm-4.6.1/
安装opencv的目录 /usr/local/
opencv源码所在目录 /usr/local /opencv-2.4.4
编译好的opencv库所在目录 /usr/local /opencv-2.4.4/build
默认安装目录为/usr/local
#mkdir build
#cd build
#cmake-gui
选择源代码目录 /usr/local /opencv-2.4.4
选择Build目录 /usr/local /opencv-2.4.4/build
点击Configure,保持generator为Unix Makefiles,选择Specify options for cross-compiling,点击Next,
Operating System填写arm-linux
C Compilers填写/usr/local/arm-4.6.1//bin/arm-none-linux-gnueabi-gcc
C++ Compilers填写/usr/local/arm-4.6.1//bin/ arm-none-linux-gnueabi -g++
程序库的Target Root填写/usr/local/arm-4.6.1/
然后点击Finish,开始configure
点击Generate生成Makefile(等configure完之后按钮才能点击)
#make
错误一:
Linking CXX executable ../../bin/opencv_createsamples
../../lib/libopencv_core.so: undefined reference to `clock_gettime'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFerrorHandler'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFrealloc'
../../lib/libopencv_core.so: undefined reference to `pthread_key_create
解决方法:
修改CMakeCache.txt,CMAKE_EXE_LINKER_FLAGS原来为空,加上-lpthread -lrt,重新编译,错误消除
错误二:
Linking CXX executable ../../bin/opencv_createsamples
../../lib/libopencv_highgui.so: undefined reference to `_TIFFerrorHandler'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFrealloc'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFmalloc'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFmemcpy'
../../lib/libopencv_highgui.so: undefined reference to `TIFFOpen'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFfree'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFwarningHandler'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFmemcmp'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFmemset'
解决方法:修改CMakeCache.txt,WITH_TIFF:BOOL=ON,改成OFF,重新编译,错误消除。
#make install
三、测试
测试程序:
#include