移植opencv-2.4.6到tiny210v2

环境: ubuntu
交叉编译:arm-linux-gcc
参考:
blog.csdn.net/top_dada/article/details/8183758
一、编译libz
     下载:
      www.zlib.net/
   配置:
  
 ./configure --prefix=/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi --shared
     修改Makefile:
           CC=arm-linux-gcc
               LDSHARED=arm-linux-gcc -shared -wl, -soname,libz.so.1,--version-script,zlib.map
               CPP=arm-linux-gcc -E
               AR=arm-linux-ar
               RANLIB=arm-linux-ranlib
   编译:
           make
           sudo make install
二、编译libjpeg
   下载:
       http://www.ijg.org/
   配置:
       ./configure --host=arm-linux --prefix=/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi --enable-shared --enable-static
   编译:
       make
       sudo make install
  出错: arm-linux-ranlib: command not found
  解决: google得是sudo的问题,在make install 之前采用su。几番尝试不行,更改安装目录
  新建个目录: ~/arm/libjpeg
./configure --host=arm-linux --prefix=/home/host/arm/libjpeg --enable-shared --enable-static
再make
make install
再复制到/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi
三、编译libpng
下载:
http://sourceforge.net/projects/libpng/files/latest/download?source=files
配置:
./configure --host=arm-linux --prefix=/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi --enable-shared --enable-static
编译make
sudo make install
四、编译yasm
下载:
   http://yasm.tortall.net/Download.html
配置:
  ./configure --host=arm-linux --prefix=/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi --enable-shared --enable-static
编译make
make install
五、编译libx264
下载:
     http://www.videolan.org/developers/x264.html
配置:
   ./configure --enable-shared --host=arm-linux --disable-asm --prefix=/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi
     修改config.mak,如下
               CC=arm-linux-gcc
               LD=arm-linux-gcc -o
               AR=arm-linux-ar rc
               RANLINB=arm-linux-ranlib
       修改库位置
编译:
     make
     sudo make install
六、编译libxvid
  下载:
     cd build/generic
   ./configure --prefix=/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi --host=arm-linux  --disable-assembly
   make
   sudo make install
七、编译ffmpeg
   下载:
         git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
   配置:

     ./configure --prefix=/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi --enable-shared --disable-static --enable-gpl --enable-cross-compile --arch=arm --disable-stripping --target-os=linux --enable-libx264 --enable-libxvid --cc=arm-linux-gcc --enable-swscale


当出现

tmp/ccOmDdh7.s: Assembler messages:
/tmp/ccOmDdh7.s:51789: Error: thumb conditional instruction should be in IT block -- `movgt fp,r9'
/tmp/ccOmDdh7.s:51790: Error: thumb conditional instruction should be in IT block -- `movgt r9,r8'
/tmp/ccOmDdh7.s:51792: Error: thumb conditional instruction should be in IT block -- `movle r9,r7'
/tmp/ccOmDdh7.s:51794: Error: thumb conditional instruction should be in IT block -- `movgt fp,r9'

这需要修改~/ffmpeg-0.5.1/config.mak,在OPTFLAGS(line:16)选项中添加:
-Wa,-mimplicit-it=thumb

   make
   make install
编译opencv之前安装cmake-gui
八、编译opencv
交叉编译工具链所在目录           /opt/FriendlyARM/toolschain/4.5.1/
安装opencv的目录                                /usr/local/
opencv源码所在目录                         /home/dongyu/opencv-2.4.6/
编译好的opencv库所在目录     /home/dongyu/opencv-2.4.6/build
#mkdir build
#cd build
#cmake-gui
选择源代码目录/home/dongyu/opencv-2.4.6/
选择Build目录:/home/dongyuopencv-2.4.6/build
点击Configure,保持generator为Unix Makefiles,
选择Specify options for cross-compiling,点击Next,
Operating System填写arm-linux
C Compilers填写/opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-gcc
C++ Compilers填写/opt/FriendlyARM/toolschain/4.5.1//bin/arm-linux-g++
程序库的Target Root填写/opt/FriendlyARM/toolschain/4.5.1/
然后点击Finish,点击Configure,产生配置列表,在其中
选择安装目录(CMAKE_INSTALL_PREFIX)为/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi
去掉WITH_CUDA,WITH_TIFF勾选,点击Generate生成Makefile
修改CMakeCache.txt,CMAKE_EXE_LINKER_FLAGS原来为空,加上-lpthread -lrt
#make
出现错误:
../../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'
CMAKE去掉TIFF支持即可;  
#make install
安装完毕    
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值