基于Linux opencv+tbb+contrib移植到ARM上

一、官网下载源码

1.opencv官网源码和contrib源码下载

  1. opencv-4.5.0
  2. opencv_contrib-4.5.0

2.解压源码

unzip xx.zip

在这里插入图片描述

二、安装编译环境

1.先安装cmake和cmake-qt-gui

sudo apt-get install cmake
sudo apt-get install cmake-qt-gui

2.创建编译输出文件夹和安装文件夹

在这里插入图片描述

3.进入配置gui

cmake-gui

这是我配置后的图片
在这里插入图片描述

三、配置编译环境

1.添加资源路径和输出路径

在这里插入图片描述

2.选择自定义编译器

在这里插入图片描述

3.编译器配置(这里的是ARM32位的编译器)

在这里插入图片描述
(1) 如果Operating System 填写的不是Linux,则可能会出现编译出来的库所依赖库的路径为相对路径,使用改库时会报错:
error while loading shared libraries: …/…/lib/libopencv_core.so: cannot open shared object file: No such file or directory

(2)查看库依赖路径:

readelf -d libopencv_core.so
  1. 错误的路径
    Dynamic section at offset 0x317ee4 contains 31 entries:
    标记 类型 名称/值
    0x00000001 (NEEDED) 共享库:[…/…/libopencv_core.so.4.5]
    0x00000001 (NEEDED) 共享库

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_high
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值