目的:交叉编译openCV库,用于xilinx的MIZ7020的FPGA的片上ARM运行。

目录

一、安装依赖项

二、安装编译器

2.1 编译器安装与路径

2.2 环境变量配置

三、安装依赖库

3.1 下载依赖库

3.2 交叉编译依赖库

zlib的交叉编译为例:

流程

libjpeg的交叉编译

libpng的交叉编译

yasm的交叉编译

libx264的交叉编译

libxvid的交叉编译

ffmpeg的交叉编译

3.3 OpenCV依赖库复制到ARM编译器路径下

操作汇总:

四、OpenCV的交叉编译

4.1 获取OpenCV源码

4.2 设置工具链toolchain.cmake

4.3 配置openCV的cmake

4.4 修改cmakeCache.txt

4.5 交叉编译

出错一、libpng

出错二、gnu/stubs-32.h

出错三、unknow register name 'st' in 'asm'

4.6 隐患

五、移植到ARM上

5.1 配置pkg-config

5.2 配置shell

六、测试

6.1 bug 找不到头文件

6.2 bug找不到编译库

6.3 ARM板运行


参考资料:https://blog.csdn.net/ajianyingxiaoqinghan/article/details/70194392  此篇博文详细的给出了整个流程与经过,非常具有参考意义。感谢此博主。

交叉编译: https://baike.baidu.com/item/%E4%BA%A4%E5%8F%89%E7%BC%96%E8%AF%91/10916911?fr=aladdin

交叉编译openCV,步骤繁琐,依赖项多,变种复杂。并且我们的xilinx SDK的交叉编译工具可能与其他arm-linux工具不同,加之是在虚拟机上交叉编译,进一步增大了难度。所以需要广泛参考,每步详细记载,并且要有耐心。流程较长,务必不要出错。

我们的编译过程比其他博客出了更多的bug,非常难以解决,基本上每步都会遇到相应的bug,好在最后问题得到了解决。

一、安装依赖项

若不装依赖项,后续make时候会出现下面报错:

       FFMPEG:                        NO--      codec:                 NO--      format:                NO--      util:                  NO--      swscale:               NO--      gentoo-style:          NO

安装依赖项命令行:

sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev

但是出现了报错

E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

解决方案   https://www.cnblogs.com/bing-yu12/p/6367894.html

https://blog.csdn.net/u011596455/article/details/60322568

完成安装。

二、安装编译器

2.1 编译器安装与路径

编译器已被装好,

编译器相关:https://www.cnblogs.com/deng-tao/p/6432578.html

编译工具命令行相关,路径等 https://blog.csdn.net/weixin_36474809/article/details/83342549

/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin
arm-linux-gnueabihf-g++
gcc version 6.2.1 20161114 (Linaro GCC Snapshot 6.2-2016.11) 

2.2 环境变量配置

环境变量配置之前我们需要确定相应的安装路径,注意,已经安装好的与以后安装的路径,一定要与这三个路径一致,以后所有涉及路径的操作,必须与你的路径一致。

在  /root/.bashrc 添加环境变量

export PATH=$PATH:/mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin      arm编译器路径

export OPENCV_DEPEND=/home/osrc/Desktop/document/arm/opencv-depend      opencv依赖库安装路径

export OPENCV_INSTALL=/home/osrc/Desktop/document/arm/opencv-install       opencv安装路径

export ARCH=arm
export CROSS_COMPILE=arm-xilinx-linux-gnueabihf-

gedit /root/.bashrc

/root/.bashrc最下方添加环境变量:

export PATH=$PATH:/mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin
export OPENCV_DEPEND=/home/osrc/Desktop/document/arm/opencv-depend
export OPENCV_INSTALL=/home/osrc/Desktop/document/arm/opencv-install
export ARCH=arm
export CROSS_COMPILE=arm-xilinx-linux-gnueabihf-

此时输入指令或重启电脑,使新的环境变量生效。输入指令如下:

source /root/.bashrc

检验环境变量生效的方法是:在root权限下,终端中输入arm,然后按Tab键,出现下面这些,表示环境变量添加成功:

root@osrc-virtual-machine:/# arm
arm2hpdl                        arm-linux-gnueabihf-gcov
arm-linux-gnueabihf-addr2line   arm-linux-gnueabihf-gcov-tool
arm-linux-gnueabihf-ar          arm-linux-gnueabihf-gdb
arm-linux-gnueabihf-as          arm-linux-gnueabihf-gprof
arm-linux-gnueabihf-c++         arm-linux-gnueabihf-ld
arm-linux-gnueabihf-c++filt     arm-linux-gnueabihf-ld.bfd
arm-linux-gnueabihf-cpp         arm-linux-gnueabihf-nm
arm-linux-gnueabihf-elfedit     arm-linux-gnueabihf-objcopy
arm-linux-gnueabihf-g++         arm-linux-gnueabihf-objdump
arm-linux-gnueabihf-gcc         arm-linux-gnueabihf-ranlib
arm-linux-gnueabihf-gcc-6.2.1   arm-linux-gnueabihf-readelf
arm-linux-gnueabihf-gcc-ar      arm-linux-gnueabihf-size
arm-linux-gnueabihf-gcc-nm      arm-linux-gnueabihf-strings
arm-linux-gnueabihf-gcc-ranlib  arm-linux-gnueabihf-strip

三、安装依赖库

3.1 下载依赖库

OpenCV交叉编译之前,首先需要对依赖库进行交叉编译。因为OpenCV依赖于很多库函数,如果在编译OpenCV之前没有编译依赖项,就会导致编译后的OpenCV无法使用。
OpenCV交叉编译时各个库的依赖关系如下所示:

OpenCVzlibjpeglibpngzlibtiffzlibffmpegx264xvidcore

下载依赖库:

注:再次,再次感谢下文博主,将相应安装包放在百度云盘上,为我节省了大量操作。 https://blog.csdn.net/ajianyingxiaoqinghan/article/details/70194392
1、本文所有操作都需要以root权限进行操作。
2、已有博主将其全部打包分享在百度云,百度云下载地址如下。
链接: https://pan.baidu.com/s/1D40Jq0u1uAbL0mpuPV9_hQ 密码: idju

下载到的依赖库如下:

  • zlib-1.2.11
  • jpegsrc.v9b
  • libpng-1.6.29
  • yasm-1.3.0
  • x264-snapshot-20170415-2245
  • xvidcore_1.3.3.orig
  • ffmpeg-2.8.11

3.2 交叉编译依赖库

将依赖库下载到相应文件夹,解压。

后面所有的交叉编译操作,都需要进入依赖库解压的地址进行操作。

zlib的交叉编译为例:

./configure --prefix=$OPENCV_DEPEND

注意,运行此步之后必须再次修改makefile,按顺序运行

将makefile之中,改为相应的与我们的编译器一致的指令,此处注意两点,

  • 一是要用root来执行相应的make操作
  • g++行不通,编译时会有error报错,要用gcc
CC=arm-linux-gnueabihf-gcc
AR=arm-linux-gnueabihf-ar
RANLIB=arm-linux-gnueabihf-ranlib
LDSHARED=arm-linux-gnueabihf-gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map

然后进行make,make install

root@osrc-virtual-machine:/home/osrc/Desktop/document/arm/opencv-depend/Cross-Compile Packages/zlib-1.2.11# make
arm-linux-gnueabihf-g++ -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -I. -c -o example.o test/example.c
test/example.c:88:20: error: variable or field ‘test_compress’ declared voidvoid test_compress(compr, comprLen, uncompr, uncomprLen)^~~~~
test/example.c:88:20: error: ‘compr’ was not declared in this scope
test/example.c:88:27: error: ‘comprLen’ was not declared in this scopevoid test_compress(compr, comprLen, uncompr, uncomprLen)^~~~~~~~
test/example.c:88:37: error: ‘uncompr’ was not declared in this scopevoid test_compress(compr, comprLen, uncompr, uncomprLen)^~~~~~~
test/example.c:88:46: error: ‘uncomprLen’ was not declared in this scopevoid test_compress(compr, comprLen, uncompr, uncomprLen)^~~~~~~~~~
test/example.c:91:1: error: expected unqualified-id before ‘{’ token{^
Makefile:147: recipe for target 'example.o' failed
make: *** [example.o] Error 1
root@osrc-virtual-machine:/home/osrc/Desktop/document/arm/opencv-depend/Cross-Compile Packages/zlib-1.2.11# make
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -I. -c -o example.o test/example.c
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o adler32.o adler32.c
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o crc32.o crc32.c
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o deflate.o deflate.c
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o infback.o infback.c
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o inffast.o inffast.c
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o inflate.o inflate.c
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o inftrees.o inftrees.c
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o trees.o trees.c
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o zutil.o zutil.c
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o compress.o compress.c
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o uncompr.o uncompr.c
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o gzclose.o gzclose.c
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o gzlib.o gzlib.c
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o gzread.o gzread.c
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o gzwrite.o gzwrite.c
arm-linux-gnueabihf-ar rc libz.a adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -o example example.o -L. libz.a
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -I. -c -o minigzip.o test/minigzip.c
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -o minigzip minigzip.o -L. libz.a
arm-linux-gnueabihf-gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/adler32.o adler32.c
arm-linux-gnueabihf-gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/crc32.o crc32.c
arm-linux-gnueabihf-gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/deflate.o deflate.c
arm-linux-gnueabihf-gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/infback.o infback.c
arm-linux-gnueabihf-gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/inffast.o inffast.c
arm-linux-gnueabihf-gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/inflate.o inflate.c
arm-linux-gnueabihf-gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/inftrees.o inftrees.c
arm-linux-gnueabihf-gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/trees.o trees.c
arm-linux-gnueabihf-gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/zutil.o zutil.c
arm-linux-gnueabihf-gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/compress.o compress.c
arm-linux-gnueabihf-gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/uncompr.o uncompr.c
arm-linux-gnueabihf-gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/gzclose.o gzclose.c
arm-linux-gnueabihf-gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/gzlib.o gzlib.c
arm-linux-gnueabihf-gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/gzread.o gzread.c
arm-linux-gnueabihf-gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/gzwrite.o gzwrite.c
arm-linux-gnueabihf-gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -o libz.so.1.2.11 adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo  -lc
rm -f libz.so libz.so.1
ln -s libz.so.1.2.11 libz.so
ln -s libz.so.1.2.11 libz.so.1
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -o examplesh example.o -L. libz.so.1.2.11
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -o minigzipsh minigzip.o -L. libz.so.1.2.11
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -I. -D_FILE_OFFSET_BITS=64 -c -o example64.o test/example.c
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -o example64 example64.o -L. libz.a
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -I. -D_FILE_OFFSET_BITS=64 -c -o minigzip64.o test/minigzip.c
arm-linux-gnueabihf-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -o minigzip64 minigzip64.o -L. libz.a
root@osrc-virtual-machine:/home/osrc/Desktop/document/arm/opencv-depend/Cross-Compile Packages/zlib-1.2.11#
root@osrc-virtual-machine:/home/osrc/Desktop/document/arm/opencv-depend/Cross-Compile Packages/zlib-1.2.11# make install
rm -f /lib/libz.a
cp libz.a /lib
chmod 644 /lib/libz.a
cp libz.so.1.2.11 /lib
chmod 755 /lib/libz.so.1.2.11
rm -f /share/man/man3/zlib.3
cp zlib.3 /share/man/man3
chmod 644 /share/man/man3/zlib.3
rm -f /lib/pkgconfig/zlib.pc
cp zlib.pc /lib/pkgconfig
chmod 644 /lib/pkgconfig/zlib.pc
rm -f /include/zlib.h /include/zconf.h
cp zlib.h zconf.h /include
chmod 644 /include/zlib.h /include/zconf.h

做完之后文件夹会多出几个目录:

流程

解压,进入解压文件夹

./configure --prefix=$OPENCV_DEPEND

来确定安装的目录

然后更改makefile的编译器gedit Makefile

CC=arm-linux-gnueabihf-gcc
AR=arm-linux-gnueabihf-ar
RANLIB=arm-linux-gnueabihf-ranlib
LDSHARED=arm-linux-gnueabihf-gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map

最后make, make install

剩下几个库按照流程如法炮制

libjpeg的交叉编译

解压jpegsrc.v9b.tar.gz,进入文件夹

注意我们与原版博客的不同,我们的编译工具arm-linux-gnueabihf系列,不是原版的arm-linux

./configure --host=arm-linux-gnueabihf CC=arm-linux-gnueabihf-gcc --prefix=$OPENCV_DEPEND --enable-shared --enable-static
更改make文档(其实不用改,上面在config已经更改,点进去make文档会发现已经被更改过)
make
make install

运行成功标志:opencv-depend之中include文件夹多了jpeglib.h

libpng的交叉编译

解压libpng-1.6.29,进入文件夹

(此库交叉编译多次,此库依赖zlib库,所以必须想办法将zlib库交叉编译。一直以来的错误是此库无法找到zlib库。发现错误在于zlib之前的LDFLAGS之前需要加-L字符)

  377  sh cmake_arm_gnueabi_softfp.sh378  cd ..379  ls380  rm -r build_linux_arm_softfp381  pwd382  cd 383  cd ..384  su385  ./configure --host=arm-linux-gnueabihf --prefix=$OPENCV_DEPEND --enable-shared386  $OPENCV_DEPEND387  echo $OPENCV_DEPEND388  ls $OPENCV_DEPEND389  ./configure --host=arm-linux-gnueabihf --prefix=$OPENCV_DEPEND --enable-shared390  echo $OPENCV_DEPEND391  pwd392  ./configure --host=arm-linux-gnueabihf --prefix=$OPENCV_DEPEND --enable-shared LDFLAGS=-L/home/osrc/Desktop/document/arm/opencv-depend/lib

下面为尝试过的(错误写法):

export LIBS=/home/osrc/Desktop/document/arm/opencv-depend/lib CPPFLAGS=/home/osrc/Desktop/document/arm/opencv-depend/include

./configure --host=arm-linux-gnueabihf --prefix=$OPENCV_DEPEND LIBS=/home/osrc/Desktop/document/arm/opencv-depend/lib CPPFLAGS=/home/osrc/Desktop/document/arm/opencv-depend/include --enable-shared --enable-static

./configure --host=arm-linux-gnueabihf --prefix=$OPENCV_DEPEND CC=arm-linux-gnueabihf-gcc

但是会提示找不到zlib的路径,因此我们采用此方法:https://blog.csdn.net/youcijibi/article/details/76427725

./configure --host=arm-linux-gnueabihf --prefix=$OPENCV_DEPEND --enable-shared --enable-static
make
make install

export LDFLAGS="/home/osrc/Desktop/document/arm/opencv-depend/lib"(此处有误导致一直不通,应该在前面加一个-L)

export CPPFLAGS="/home/osrc/Desktop/document/arm/opencv-depend/include"

正确方法如下:

./configure --host=arm-linux-gnueabihf --prefix=$OPENCV_DEPEND --enable-shared LDFLAGS=-L/home/osrc/Desktop/document/arm/opencv-depend/lib

然后make,make install

yasm的交叉编译

解压,进入文件夹

CC=arm-linux-gnueabihf-gcc ./configure --enable-shared --host=arm-linux-gnueabihf --disable-asm --prefix=$OPENCV_DEPEND
make
make install

运行成功标志:opencv-depend之中include文件夹多了一个libyasm文件夹

libx264的交叉编译

解压last_x264.tar.bz2并进入文件夹

CC=arm-linux-gnueabihf-gcc ./configure --enable-shared --host=arm-linux-gnueabihf --disable-asm --prefix=$OPENCV_DEPEND
make
make install

运行成功标志:opencv-depend之中include文件夹多了一个x264_config.h文件

libxvid的交叉编译

解压文件xvidcore_1.3.3.orig.tar.gz,并进入文件夹及其子目录(注意此处与之前不同)

cd build/generic
./configure --prefix=$OPENCV_DEPEND --host=arm-linux-gnueabihf --disable-assembly
make
make install

运行成功标志:opencv-depend之中include文件夹多了一个xvid.h文件

ffmpeg的交叉编译

解压ffmpeg-2.8.11.tar.gz,并进入文件夹(注意,需要为2.8版本,不要下载新的3.3版本!否则会编译出错)

./configure --prefix=$OPENCV_DEPEND --enable-shared --disable-static --enable-gpl --enable-cross-compile --arch=arm --disable-stripping --target-os=linux --enable-libx264 --enable-libxvid --cc=arm-linux-gnueabihf-gcc --enable-swscale --extra-ldflags=-L$OPENCV_DEPEND/lib --extra-cflags=-I$OPENCV_DEPEND/include

然后make ,make install

此程序make时间较长。

运行成功后lib文件夹多出av系列函数。

至此,依赖库交叉编译完成。

3.3 OpenCV依赖库复制到ARM编译器路径下

需要将前面路径下的lib和include中所有文件分别拷贝到后面路径下的lib和include下。注意此处要按照我们的目录来修改。

/home/osrc/Desktop/document/arm/opencv-depend
/mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi
/mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/arm-linux-gnueabihf

命令行如下:

cp -r /home/osrc/Desktop/document/arm/opencv-depend/include/ /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/
cp -r /home/osrc/Desktop/document/arm/opencv-depend/lib/ /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/

为保险起见,我们将子文件夹中的hf文件夹也多拷一份

cp -r /home/osrc/Desktop/document/arm/opencv-depend/include/ /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/arm-linux-gnueabihf
cp -r /home/osrc/Desktop/document/arm/opencv-depend/lib/ /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/arm-linux-gnueabihf

即使进行了拷贝,但后面仍然有编译器找不到相应的lib的情况,再此后还会出相应的bug。因此,我们可能在后面需要指定相应的地方更改,在arm/openCV-2.4.9/arm-build/modules/highgui/CMakeFiles/opencv-highgui.dir之中更改,这个后面会谈。

操作汇总:

  389  ./configure --host=arm-linux-gnueabihf --prefix=$OPENCV_DEPEND --enable-shared390  echo $OPENCV_DEPEND391  pwd392  ./configure --host=arm-linux-gnueabihf --prefix=$OPENCV_DEPEND --enable-shared LDFLAGS=-L/home/osrc/Desktop/document/arm/opencv-depend/lib393  history394  make395  make install396  cd ..397  cd yasm-1.3.0398  ls399  CC=arm-linux-gnueabihf-gcc ./configure --enable-shared --host=arm-linux-gnueabihf --disable-asm --prefix=$OPENCV_DEPEND400  make401  make install402  CC=arm-linux-gnueabihf-gcc ./configure --enable-shared --host=arm-linux-gnueabihf --disable-asm --prefix=$OPENCV_DEPEND403  make404  make install405  cd ..406  ls407  cd x264-snapshot-20170415-2245/408  ls409  CC=arm-linux-gnueabihf-gcc ./configure --enable-shared --host=arm-linux-gnueabihf --disable-asm --prefix=$OPENCV_DEPEND410  make411  make install412  cd ..413  cd xvidcore414  ls415  cd xvidcore-1416  cd xvidcore-1.3.3/417  ls418  cd build/generic/419  ls420  ./configure --prefix=$OPENCV_DEPEND --host=arm-linux-gnueabihf --disable-assembly421  make422  make install423  cd ..424  ls425  cd ffmpeg-2.8.11426  ls427  ./configure --prefix=$OPENCV_DEPEND --enable-shared --disable-static --enable-gpl --enable-cross-compile --arch=arm --disable-stripping --target-os=linux --enable-libx264 --enable-libxvid --cc=arm-linux-gnueabihf-gcc --enable-swscale --extra-ldflags=-L$OPENCV_DEPEND/lib --extra-cflags=-I$OPENCV_DEPEND/include428  make429  make install430  cd /home/osrc/Desktop/document/arm/opencv-depend431  ls432  cd /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi433  ls434  cd arm-linux-gnueabihf/435  ls436  pwd437  ls438  cp -r /home/osrc/Desktop/document/arm/opencv-depend/include/ /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/439  cp -r /home/osrc/Desktop/document/arm/opencv-depend/lib/ /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/440  cp -r /home/osrc/Desktop/document/arm/opencv-depend/include/ /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/arm-linux-gnueabihf441  cp -r /home/osrc/Desktop/document/arm/opencv-depend/lib/ /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/arm-linux-gnueabihf442  cd /home/osrc/Desktop/document/arm/opencv-2.4.9443  ls444  mkdir arm-build445  cd arm-build/446  ls447  gedit toolchain.cmake448  cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake ../449  cmake-gui450  cd CMakeCache.txt 451  gedit CMakeCache.txt 452  make453  yum -y install glibc-devel454  sudo apt-get install g++-multilib455  cmake-gui456  gedit CMakeCache.txt 457  make

四、OpenCV的交叉编译

4.1 获取OpenCV源码

这里使用的是OpenCV 2.4.9版本,可以在官网上下载。
官网下载地址:http://opencv.org/releases.html

注:不带交叉编译,而是直接编译的openCV见此:https://blog.csdn.net/weixin_36474809/article/details/83373908

4.2 设置工具链toolchain.cmake

下载并解压OpenCV后,进入OpenCV 2.4.9的路径,并新建文件夹arm-build(与之前的build区分):工程要在此文件夹下进行。

在arm-build文件夹中,用vim或gedit新建文件toolchain.cmake

gedit toolchain.cmake

在里面添加下面内容:(路径内容要与自己的一致,编译工具链要与自己的一致)

###########user defined#############
set( CMAKE_SYSTEM_NAME Linux )
set( CMAKE_SYSTEM_PROCESSOR arm )
set( CMAKE_C_COMPILER arm-linux-gnueabihf-gcc )
set( CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++ )
###########user defined#############
set( CMAKE_FIND_ROOT_PATH "/home/osrc/Desktop/document/arm/opencv-depend/" )
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
######################################

运行下面内容

cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake ../

4.3 配置openCV的cmake

安装并运行cmake的gui(下文中路径好像有误,应该在arm-build之中运行)

root@osrc-virtual-machine:/home/osrc/Desktop/document/opencv-2.4.9/build# cmake-gui
The program 'cmake-gui' is currently not installed. You can install it by typing:
apt install cmake-qt-gui
root@osrc-virtual-machine:/home/osrc/Desktop/document/opencv-2.4.9/build# apt install cmake-qt-gui

cmake-gui

然后设置相应的目录,

  • source code:      /home/osrc/Desktop/document/arm/opencv-2.4.9
  • build binaries:    /home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build
  • CMAKE_INSTALL_PREFIX(安装目录),默认为/opencv-2.4.9/build/install,改为我们之前设置的安装目录:/home/osrc/Desktop/document/arm/opencv-install
  • 去掉 WITH_CUDA
  • 去掉 WITH_GTK
  • 去掉 WITH_1394
  • 去掉 WITH_GSTREAMER
  • 去掉 WITH_LIBV4L
  • 去掉 WITH_TIFF
  • 去掉 BUILD_OPENEXR
  • 去掉 WITH_OPENEXR
  • 去掉 BUILD_opencv_ocl
  • 去掉 WITH_OPENCL(注意区分OPENGL与OPENCL的区别)
  • 去掉 WITH MMPEG

做好相应更改之后,把config与generate

我们的项目并不需要mmpeg的库,并且在后面的交叉编译之中mmpeg库总是出现错误,因此我们去掉WITH MMPEG。

4.4 修改cmakeCache.txt

此时修改在/opencv-2.4.9/arm-build文件夹中的CMakeCache.txt
CMAKE_EXE_LINKER_FLAGS选项本来为空,此时在后面加上:-lpthread -lrt

4.5 交叉编译

在路径arm-build路径下,进行 make 与make install

出错一、libpng

[  5%] Generating precomp.hpp
[  5%] Generating precomp.hpp.gch/opencv_core_Release.gch
/mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/../arm-linux-gnueabihf/libc/usr/lib/crt1.o: In function `_start':
init.c:(.text+0x34): undefined reference to `main'
collect2: error: ld returned 1 exit status
modules/core/CMakeFiles/pch_Generate_opencv_core.dir/build.make:62: recipe for target 'modules/core/precomp.hpp.gch/opencv_core_Release.gch' failed
make[2]: *** [modules/core/precomp.hpp.gch/opencv_core_Release.gch] Error 1
CMakeFiles/Makefile2:1102: recipe for target 'modules/core/CMakeFiles/pch_Generate_opencv_core.dir/all' failed
make[1]: *** [modules/core/CMakeFiles/pch_Generate_opencv_core.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2

后续发现如此低级错误可能是少编译了libpng的库。也说明流程较长时候必须要有足够的耐心,并且要及时检验。

后续libpng依然出错,config时显示找不到zlib,在config之中加LDFLAGS即可,见上面libpng的编译。

出错二、gnu/stubs-32.h

[11%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui_pch_dephelp.dir/opencv_highgui_pch_dephelp.cxx.o
cc1plus: warning: include location "/usr/include/x86_64-linux-gnu" is unsafe for cross-compilation [-Wpoison-system-directories]
。。。
/usr/include/x86_64-linux-gnu/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory# include <gnu/stubs-32.h>^
compilation terminated.
modules/highgui/CMakeFiles/opencv_highgui_pch_dephelp.dir/build.make:71: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui_pch_dephelp.dir/opencv_highgui_pch_dephelp.cxx.o' failed

解决方法:  sudo apt-get install g++-multilib

之后再make,编译器很快接上面%11继续。

出错三、unknow register name 'st' in 'asm'

[ 16%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o
cc1plus: warning: include location "/usr/include/x86_64-linux-gnu" is unsafe for cross-compilation [-Wpoison-system-directories]
In file included from /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/arm-linux-gnueabihf/libc/usr/include/math.h:472:0,from /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/arm-linux-gnueabihf/include/c++/6.2.1/cmath:45,from /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/arm-linux-gnueabihf/include/c++/6.2.1/math.h:36,from /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include/opencv2/core/types_c.h:94,from /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include/opencv2/core/core.hpp:49,from /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include/opencv2/highgui/highgui.hpp:46,from /home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp:47:
/usr/include/x86_64-linux-gnu/bits/mathinline.h: In member function ‘virtual bool CvCapture_Images::setProperty(int, double)’:
/usr/include/x86_64-linux-gnu/bits/mathinline.h:889:3: error: unknown register name ‘st’ in ‘asm’__lrint_code;^
/usr/include/x86_64-linux-gnu/bits/mathinline.h:889:3: error: unknown register name ‘st’ in ‘asm’__lrint_code;^
modules/highgui/CMakeFiles/opencv_highgui.dir/build.make:86: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o' failed
  491  cd arm-build/492  gedit toolchain.cmake493  cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake ../494  cmake-gui495  cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake ../496  gedit CMakeCache.txt 497  cmake ..498  make499  ls500  make501  ls502  cd ..503  ls504  grep -rn lrint_code505  pwd506  cd 507  pwd508  find -name mathinline.h509  cd ..510  find -name mathinline.h511  cd /home/osrc/Desktop/document/arm/opencv-2.4.9512  ls513  cd arm-build/514  ls515  cd CMakeFiles 516  ls517  cd ..518  ls519  cd toolchain.cmake520  vi toolchain.cmake521  ls522  vi CMakeCache.txt523  cd  bin524  ls525  cd ..526  ls527  vi Makefile 528  grep -rn include_directories529  :q530  :q!531  ls532  cmake-gui533  make534  find ./ -name link*535  cat ./modules/gpu/CMakeFiles/opencv_gpu.dir/link.txt536  cmake-gui537  ls538  cat toolchain.cmake 539  find -name CMakeFiles*540  ls541  cd .542  cd ..543  ls544  vi CMakeLists.txt 545  gedit CMakeLists.txt 546  cd arm-build/547  ls548  gedit CMakeLists.txt 549  cd ..550  gedit CMakeLists.txt 551  cd arm-build/552  cmake-gui553  cmake ..554  make555  make -j4

王博解决方案:

  491  cd arm-build/492  gedit toolchain.cmake493  cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake ../494  cmake-gui495  cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake ../496  gedit CMakeCache.txt 497  cmake ..498  make499  ls500  cd modules/501  ls502  cd CMakeFiles/503  ls504  cd ..505  cd higigui506  cd highgui507  ls508  cd CMakeFiles/509  ls510  cd opencv_highgui.dir/511  ls512  grep "x86_64" * -r513  vi flags.make 514  ls515  mv CXX.includecache CXX.includecache.origin516  rm CXX.includecache.origin 517  ls518  make519  grep "Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o" * -r520  vi build.make 521  ls522  vi flags.make 523  ls524  vi /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/arm-linux-gnueabihf/libc/usr/include/math.h525  vi flags.make 526  ls527  vi build.make 528  ls529  vi flags.make 530  pwd531  ls532  vi flags.make 533  ls -l534  cd ..535  make536  ls537  make

在opencv_higui.dir之中寻找相应的文档,更改flags.make文档,与build.make文档与一个aarch的设置有关。

  614  cd CMakeFiles/615  grep "/usr/include/x86_64-linux-gnu" * -r616  grep "x86_64-linux-gnu" * -r617  ls618  cd .619  cd ..620  cd modules/621  ls622  cd CMakeFiles/623  grep "/usr/include/x86_64-linux-gnu" * -r624  grep "x86_64-linux-gnu" * -r625  ls626  cd ..627  ls628  cd CMakeFiles/629  ls630  cd ..631  ls632  cd ..633  ls634  cd CMakeFiles/635  ls636  cd modules637  ls638  cd ..639  cd modules/640  ls641  cd CMakeFiles/642  ls643  cd ..644  find . -name highgui645  cd highgui646  ls647  cd CMakeFiles/648  ls649  grep "x86_64-linux-gnu" * -r650  grep "/usr/include/x86_64-linux-gnu" * -r651  grep "/usr/include/x86_64-linux-gnu" * -r | more652  ls653  cd opencv_highgui.dir/654  ls655  grep "/usr/include/x86_64-linux-gnu" * -r | more656  vi flags.make 657  pwd658  cd ..659  make660  ls661  ls -l662  make663  vi /tmp/wy.txt664  make665  vi /tmp/wy.txt666  make667  cat /tmp/wy.txt668  make669  cat /tmp/wy.txt670  vi /tmp/wy.txt671  make672  cat /tmp/wy.txt673  make674  ls675  vi /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/arm-linux-gnueabihf/libc/usr/include/math.h676  make677  ls678  vi CMakeCache.txt 679  make680  cd cd /home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui681  cd /home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui682  ls683  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ 684  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -isystem /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/arm-linux-gnueabihf/libc/usr/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch  -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp685  history686  history > wy.txt687  vi wy.txt688  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -isystem /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/arm-linux-gnueabihf/libc/usr/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch -march=armv5te -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp689  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -isystem /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/arm-linux-gnueabihf/libc/usr/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch -march=armv7 -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp690  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -isystem /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/arm-linux-gnueabihf/libc/usr/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch -march=arm -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp691  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -isystem /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/arm-linux-gnueabihf/libc/usr/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch -march=armv8.2-a -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp692  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch -march=armv8.2-a -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp693  history > wy.txt694  vi wy.txt695  ls696  cd ..697  make698  ls699  cd 700  cd /home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui701  ls702  vi wy.txt703  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch -march=armv8.2-a -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp704  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch -march=arm -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp705  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch -march=native -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp706  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch -march=armv8-m.main -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp707  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch -march=armv7-m -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp708  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch -march=armv7 -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp709  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch -march=armv8.a -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp710  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch -march=armv8 -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp711  cd /mnt/workspace/712  ls713  cd Xilinx/714  l715  ls716  cd SDK717  ls718  cd 2017.4/719  ls720  cd bin/721  ls722  d ..723  cd ..724  ls725  cd gnu/726  ls727* cd aarch~728  cd aarch32729  ls730  cd lin/731  ls732  cd gcc-arm-linux-gnueabi/733  ls734  cd bin/735  ls736  ./arm-linux-gnueabihf-gcc -v737  cd /home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui738  /home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui# /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch -march=armv8 -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp739  ls740  vi wy.txt741  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch -march=armv8.2-a -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp742  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch -march=armv7-a -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp743  /home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui# /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch -march=armv8 -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp744  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch -march=armv8 -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp745  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch -march=armv7-a -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp746  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch --with-arch=armv7-a -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp747  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch -march=armv7-a -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp748  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch -march=armv8-a -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp749  ls 750  ls CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o751  ls CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -l752  /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-g++ -DCVAPI_EXPORTS -DHIGHGUI_EXPORTS -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/perf -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/features2d/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/imgproc/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/flann/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/core/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/ts/include -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src -I/home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/test -I/home/osrc/Desktop/document/arm/opencv-2.4.9/3rdparty/libjasper -I/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build -isystem /home/osrc/Desktop/document/arm/opencv-depend/include -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG -fPIC -include "/home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui/precomp.hpp" -Winvalid-pch -march=armv8-a -o CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -c /home/osrc/Desktop/document/arm/opencv-2.4.9/modules/highgui/src/cap_images.cpp753  cd ..754  make755  cd /home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui756  ls757  ls -l758  cd ..759  ls760  cd CMakeFiles/761  ls762  cd ..763  cd CMakeFiles/764  ls765  cd mo766  ls767  pwd768  ls769  cd ..770  cd modules/771  ls772  cd highgui/773  ls774  cd CMakeFiles/775  ls776  cd ..777  ls778  cd CMakeFiles/779  ls780  cd ..781  cd higui782  ls783  cd highgui784  ls785  cd CMakeFiles/786  ls787  cd opencv_highgui.dir/788  ls789  vi flags.make 790  make791  pwd792  vi flags.make 793  ls794  vi flags.make 795  vi build.make 796  find . -name cap_images*797  rm src/cap_images.cpp.o 798  LS799  ls800  vi build.make 
  875  make876  vi modules/nonfree/CMakeFiles/opencv_perf_nonfree.dir/link.txt 877  make878  vi modules/objdetect/CMakeFiles/opencv_test_objdetect.dir/link.txt 879  make -j4880  make881  vi modules/objdetect/CMakeFiles/opencv_perf_objdetect.dir/link.txt 882  make883  vi modules/objdetect/CMakeFiles/opencv_test_objdetect.dir/link.txt 884  make885  vi modules/photo/CMakeFiles/opencv_test_photo.dir/link.txt 886  make -j4887  vi modules/photo/CMakeFiles/opencv_perf_photo.dir/link.txt 888  make -j4889  vi modules/stitching/CMakeFiles/opencv_perf_stitching.dir/link.txt 890  vi modules/stitching/CMakeFiles/opencv_test_stitching.dir/link.txt 891  make -j4892  history

此步出错在于编译器找不到相应的文件,所以我们需要在相应的CMakeFiles之中添加下面的东西。位置 arm/opencv-2.4.9/arm-build/modules/highgui/CMakeFiles/opencv-highgui.dir,,这个文件制定了相应的路径。我们在后面添加依赖路径,注意语法,前后冒号。

  799  ls800  vi build.make 801  history802  cd /home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build803  ls804  cd modules/highgui/CMakeFiles/opencv_highgui.dir/build.make805  cd modules/highgui/CMakeFiles/opencv_highgui.dir/806  vi build.make 807  cp link.txt ../link.txt808  vi link.txt 809  vi ../link.txt 

另外,必须把另一个core的时候也出现此问题,因此,也需要把core的后面加相应的dir加路径。

/arm/opencv-2.4.9/arm-build/modules/core/CMakeFiles/opencv_perf_core.dir

解决了这些bug之后,终于编译完成

[ 85%] Built target opencv_test_imgproc
[ 85%] Linking CXX executable ../../bin/opencv_test_highgui
[ 85%] Built target opencv_perf_highgui
[ 86%] Built target opencv_test_highgui
[ 88%] Built target opencv_test_features2d
[ 89%] Built target opencv_perf_features2d
[ 90%] Built target opencv_perf_calib3d
[ 93%] Built target opencv_test_calib3d
[ 94%] Built target opencv_test_ml
[ 94%] Built target opencv_test_objdetect
[ 95%] Built target opencv_nonfree
[ 95%] Built target opencv_perf_objdetect
[ 95%] Built target opencv_test_photo
[ 95%] Built target opencv_perf_photo
[ 96%] Built target opencv_test_nonfree
[ 97%] Built target opencv_perf_nonfree
[ 99%] Built target opencv_stitching
[100%] Built target opencv_test_stitching
[100%] Built target opencv_perf_stitching

make install

4.6 隐患

  • mmpeg可能没用到,没有编译
  • aarch的设置

五、移植到ARM上

5.1 配置pkg-config

参考:https://blog.csdn.net/luotuo44/article/details/24836901

用第三方库,就少不了要使用到第三方的头文件和库文件。我们在编译、链接的时候,必须要指定这些头文件和库文件的位置。
对于一个比较大第三方库,其头文件和库文件的数量是比较多的。如果我们一个个手动地写,那将是相当麻烦的。所以,pkg-config就应运而生了。pkg-config能够把这些头文件和库文件的位置指出来,给编译器使用。
平常都是这样用pkg-config的:

gcc main.c `pkg-config --cflags --libs gtk+-2.0` -o main

此为把gtk的头文件路径和库文件列出来,让编译去获取。–cflags和–libs分别指定头文件和库文件。

在前面的OpenCV配置过程中,pkg-config便已经生成。生成地址为/usr/local/arm/opencv-install/lib/pkgconfig/opencv.pc

(注意,make install之后才有此步)

5.2 配置shell

gedit /etc/bash.bashrc

在最后一行加入:注意路径要与自己的一致。
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/home/osrc/Desktop/document/arm/opencv-install/lib/pkgconfig
export PKG_CONFIG_PATH

如图

然后 source /etc/bash.bashrc

六、测试

创建并编辑test.cpp文件

#include <cv.h>
#include <highgui.h>
#include <iostream>
using namespace std;int main(int argc, char *argv[])
{IplImage* image = cvLoadImage("/root/Desktop/miska.jpg");if(image == NULL){cout<<"loud image fail"<<endl;return -1;}cvNamedWindow("src", 1);cvShowImage("src", image);cvWaitKey();cvDestroyWindow("src");cvReleaseImage(&image);return 0;
}

保存并退出之后,输入如下:

arm-linux-gnueabihf-g++ `pkg-config --cflags --libs opencv` test.cpp -lpthread -lrt -o test

6.1 bug 找不到头文件

root@osrc-virtual-machine:/home/osrc/Desktop/document/test-opencv# arm-linux-gnueabihf-g++ `pkg-config --cflags --libs opencv` test.cpp -lpthread -lrt -o test
In file included from test.cpp:1:0:
/home/osrc/Desktop/document/arm/opencv-install/include/opencv/cv.h:67:38: fatal error: opencv2/video/tracking.hpp: No such file or directory#include "opencv2/video/tracking.hpp"^
compilation terminated.

显示没有相应的文件,我们在modules中把相应的文件夹拷贝到opencv install之中,然后将include之中同名的文件拷出来。

/home/osrc/Desktop/document/arm/opencv-install/include/opencv/cv.h:72:37: fatal error: opencv2/legacy/compat.hpp: No such file or directory#include "opencv2/legacy/compat.hpp"

一次video文件夹,一次legency文件夹。

然后编译,解决了相应的找不到头文件的问题。

6.2 bug找不到编译库

/mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabihf/6.2.1/../../../../arm-linux-gnueabihf/bin/ld: warning: libz.so.1, needed by /home/osrc/Desktop/document/arm/opencv-install/lib/libopencv_core.so, not found (try using -rpath or -rpath-link)
/mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabihf/6.2.1/../../../../arm-linux-gnueabihf/bin/ld: warning: libjpeg.so.9, needed by /home/osrc/Desktop/document/arm/opencv-install/lib/libopencv_highgui.so, not found (try using -rpath or -rpath-link)
/mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabihf/6.2.1/../../../../arm-linux-gnueabihf/bin/ld: warning: libpng16.so.16, needed by /home/osrc/Desktop/document/arm/opencv-install/lib/libopencv_highgui.so, not found (try using -rpath or -rpath-link)

找不到zlib,找不到libjpeg,找不到libpng,   warning: libz.so.1, needed by。。。

尝试解决方法一、将相应的opencv-depend库里面的内容搬到opencv-install里面。

cp -r /home/osrc/Desktop/document/arm/opencv-depend/include/ /home/osrc/Desktop/document/arm/opencv-install/
cp -r /home/osrc/Desktop/document/arm/opencv-depend/lib/ /home/osrc/Desktop/document/arm/opencv-install/

运行之后并不成功。

尝试解决方法二、编译时加入 -Wl,-rpath,/home/osrc/Desktop/document/arm/opencv-depend/lib/:/home/osrc/Desktop/document/arm/opencv-depend/lib/:

https://www.cnblogs.com/candl/p/7358384.html

https://www.cnblogs.com/homejim/p/8004883.html

命令行:

arm-linux-gnueabihf-g++ `pkg-config --cflags --libs opencv` test.cpp -lpthread -lrt -o test -Wl,-rpath,/home/osrc/Desktop/document/arm/opencv-depend/lib/:/home/osrc/Desktop/document/arm/opencv-install/lib/:

终于运行成功,生成test文件。非常繁琐的步骤,中间出现了无数的bug,好在终于完成了运行。

6.3 ARM板运行

在运行时,还要把arm/opencv-install/lib目录下的所有.so文件都拷贝到arm的/usr/lib或者/lib目录下。

详细运行步骤见:ARM单片机编译与运行程序MTCNN  https://blog.csdn.net/weixin_36474809/article/details/83342549

虚拟机交叉编译openCV详细步骤及bug解决详解相关推荐

  1. 【git】git冲突解决详解

    git冲突解决详解 方法1:pull下来然后修改冲突文件 方法2: cherry-pick然后checkout git merge时,不免产生各种各样的冲突,可是我们连如何选择版本都晕半天,这里进行详 ...

  2. 干货 | OpenCV中KLT光流跟踪原理详解与代码演示

    点击上方"小白学视觉",选择加"星标"或"置顶" 重磅干货,第一时间送达 本文转自:opencv学堂 稀疏光流跟踪(KLT)详解 在视频移动 ...

  3. OpenCV参考手册之Mat类详解

    OpenCV参考手册之Mat类详解(一) OpenCV参考手册之Mat类详解(二) OpenCV参考手册之Mat类详解(三)

  4. SVN 树冲突解决详解

    SVN 树冲突解决详解 https://blog.51cto.com/u_15047490/4217803?abTest=51cto

  5. 适合centos7 64位虚拟机添加硬盘 详细 步骤

    文章目录 前言 步骤 1.虚拟机增加硬盘(重启后可见) 2.分区 3.格式化 4.挂载 5.设置永久挂载 总结 前言 Linux系统中,关于centos7安装新增硬盘的详细步骤如下,这里以添加sdb硬 ...

  6. 线性回归 - 多元线性回归案例 - 分析步骤、输出结果详解、与Python的结果对比 -(SPSS建模)

    现在用 Python 写线性回归的博客都快烂大街了,为什么还要用 SPSS 做线性回归呢?这就来说说 SPSS 存在的原因吧. SPSS 是一个很强大的软件,不用编程,不用调参,点巴两下就出结果了,而 ...

  7. 最详细的equals和hashcode详解

    java.lang.Object类中有两个非常重要的方法: public boolean equals(Object obj)public int hashCode() Object类是类继承结构的基 ...

  8. 史上最全最详细多种手机主流操作系统详解

    史上最全最详细多种主流操作系统详解(经典,值得收藏) 2017-06-09 18:07 操作系统 一.手机操作系统 1 Android 谷歌安卓 这里写图片描述(https://img-blog.cs ...

  9. 支持向量机SVM详细原理,Libsvm工具箱详解,svm参数说明,svm应用实例,神经网络1000案例之15

    目录 支持向量机SVM的详细原理 SVM的定义 SVM理论 Libsvm工具箱详解 简介 参数说明 易错及常见问题 SVM应用实例,基于SVM的股票价格预测 支持向量机SVM的详细原理 SVM的定义 ...

最新文章

  1. Python语言学习之时间那些事:python和时间的使用方法之详细攻略
  2. 【转】SAP中的FTP操作样例
  3. 内网穿透工具ngrok的使用
  4. LQ训练营(C++)学习笔记_广度优先搜索
  5. php_sapi常量,PHP常量PHP_SAPI与函数php_sapi_name()简介,PHP运行环境检测
  6. 今天一看,自己发的文章原来这么多了。openeim
  7. mysql workbench for ubuntu测试
  8. flask-sqlalchemy Configuration
  9. 海龟绘图两小时上手C语言 - 1 绘制直线
  10. java里的sqlite在哪_设备上sqlite数据库的位置
  11. 下载Googleearth地图作为底图显示曝光点
  12. 网页前端学习第五次(HTML)
  13. mc小刘yeah粉丝网
  14. 2019年电子设计国赛综合测评回顾
  15. android颜色透明度换算详解
  16. 阿里七年Java练习生,如今年薪50W,P7的大佬是怎么样的?
  17. 固态硬盘安装--系统迁移--设置引导启动项
  18. Location虚拟定位
  19. OccuSeg: Occupancy-aware 3D Instance Segmentation
  20. ASCII Binary

热门文章

  1. MathorCup赛前准备
  2. EasyUI/TopJUI可编辑表格的列根据返回数据判断是使用 combobox 还是 numberbox
  3. java catch抛出异常_java异常——捕获异常+再次抛出异常与异常链
  4. java事务抛异常_java中抛异常后如何使事务回滚
  5. .NET MVC:实现导出Excel表格
  6. 完美主义容易导致效率低下
  7. Nature综述:肠道菌群与结直肠癌的研究进展
  8. JS 设置 Cookie
  9. 12 个最佳的免费网络监控工具、免费网站监控工具超级好用的有那些
  10. 10分钟设置免费远程桌面