目的:交叉编译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
完成安装。
编译器已被装好,
编译器相关: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)
环境变量配置之前我们需要确定相应的安装路径,注意,已经安装好的与以后安装的路径,一定要与这三个路径一致,以后所有涉及路径的操作,必须与你的路径一致。
在 /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
OpenCV交叉编译之前,首先需要对依赖库进行交叉编译。因为OpenCV依赖于很多库函数,如果在编译OpenCV之前没有编译依赖项,就会导致编译后的OpenCV无法使用。
OpenCV交叉编译时各个库的依赖关系如下所示:
OpenCV
zlib
jpeg
libpng
zlib
tiff
zlib
ffmpeg
x264
xvidcore
下载依赖库:
注:再次,再次感谢下文博主,将相应安装包放在百度云盘上,为我节省了大量操作。 https://blog.csdn.net/ajianyingxiaoqinghan/article/details/70194392
1、本文所有操作都需要以root权限进行操作。
2、已有博主将其全部打包分享在百度云,百度云下载地址如下。
链接: https://pan.baidu.com/s/1D40Jq0u1uAbL0mpuPV9_hQ 密码: idju
下载到的依赖库如下:
将依赖库下载到相应文件夹,解压。
后面所有的交叉编译操作,都需要进入依赖库解压的地址进行操作。
./configure --prefix=$OPENCV_DEPEND
注意,运行此步之后必须再次修改makefile,按顺序运行
将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
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 void
void 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 scope
void test_compress(compr, comprLen, uncompr, uncomprLen)
^~~~~~~~
test/example.c:88:37: error: ‘uncompr’ was not declared in this scope
void test_compress(compr, comprLen, uncompr, uncomprLen)
^~~~~~~
test/example.c:88:46: error: ‘uncomprLen’ was not declared in this scope
void 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
剩下几个库按照流程如法炮制
解压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-1.6.29,进入文件夹
(此库交叉编译多次,此库依赖zlib库,所以必须想办法将zlib库交叉编译。一直以来的错误是此库无法找到zlib库。发现错误在于zlib之前的LDFLAGS之前需要加-L字符)
377 sh cmake_arm_gnueabi_softfp.sh
378 cd ..
379 ls
380 rm -r build_linux_arm_softfp
381 pwd
382 cd
383 cd ..
384 su
385 ./configure --host=arm-linux-gnueabihf --prefix=$OPENCV_DEPEND --enable-shared
386 $OPENCV_DEPEND
387 echo $OPENCV_DEPEND
388 ls $OPENCV_DEPEND
389 ./configure --host=arm-linux-gnueabihf --prefix=$OPENCV_DEPEND --enable-shared
390 echo $OPENCV_DEPEND
391 pwd
392 ./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
解压,进入文件夹
CC=arm-linux-gnueabihf-gcc ./configure --enable-shared --host=arm-linux-gnueabihf --disable-asm --prefix=$OPENCV_DEPEND
make
make install
运行成功标志:opencv-depend之中include文件夹多了一个libyasm文件夹
解压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文件
解压文件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-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系列函数。
至此,依赖库交叉编译完成。
需要将前面路径下的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-shared
390 echo $OPENCV_DEPEND
391 pwd
392 ./configure --host=arm-linux-gnueabihf --prefix=$OPENCV_DEPEND --enable-shared LDFLAGS=-L/home/osrc/Desktop/document/arm/opencv-depend/lib
393 history
394 make
395 make install
396 cd ..
397 cd yasm-1.3.0
398 ls
399 CC=arm-linux-gnueabihf-gcc ./configure --enable-shared --host=arm-linux-gnueabihf --disable-asm --prefix=$OPENCV_DEPEND
400 make
401 make install
402 CC=arm-linux-gnueabihf-gcc ./configure --enable-shared --host=arm-linux-gnueabihf --disable-asm --prefix=$OPENCV_DEPEND
403 make
404 make install
405 cd ..
406 ls
407 cd x264-snapshot-20170415-2245/
408 ls
409 CC=arm-linux-gnueabihf-gcc ./configure --enable-shared --host=arm-linux-gnueabihf --disable-asm --prefix=$OPENCV_DEPEND
410 make
411 make install
412 cd ..
413 cd xvidcore
414 ls
415 cd xvidcore-1
416 cd xvidcore-1.3.3/
417 ls
418 cd build/generic/
419 ls
420 ./configure --prefix=$OPENCV_DEPEND --host=arm-linux-gnueabihf --disable-assembly
421 make
422 make install
423 cd ..
424 ls
425 cd ffmpeg-2.8.11
426 ls
427 ./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
428 make
429 make install
430 cd /home/osrc/Desktop/document/arm/opencv-depend
431 ls
432 cd /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi
433 ls
434 cd arm-linux-gnueabihf/
435 ls
436 pwd
437 ls
438 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-gnueabihf
441 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
442 cd /home/osrc/Desktop/document/arm/opencv-2.4.9
443 ls
444 mkdir arm-build
445 cd arm-build/
446 ls
447 gedit toolchain.cmake
448 cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake ../
449 cmake-gui
450 cd CMakeCache.txt
451 gedit CMakeCache.txt
452 make
453 yum -y install glibc-devel
454 sudo apt-get install g++-multilib
455 cmake-gui
456 gedit CMakeCache.txt
457 make
这里使用的是OpenCV 2.4.9版本,可以在官网上下载。
官网下载地址:http://opencv.org/releases.html
注:不带交叉编译,而是直接编译的openCV见此:https://blog.csdn.net/weixin_36474809/article/details/83373908
下载并解压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 ../
安装并运行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
然后设置相应的目录,
做好相应更改之后,把config与generate
我们的项目并不需要mmpeg的库,并且在后面的交叉编译之中mmpeg库总是出现错误,因此我们去掉WITH MMPEG。
此时修改在/opencv-2.4.9/arm-build
文件夹中的CMakeCache.txt
:
CMAKE_EXE_LINKER_FLAGS选项本来为空,此时在后面加上:-lpthread -lrt
在路径arm-build路径下,进行 make 与make install
[ 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的编译。
[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
^
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继续。
[ 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.cmake
493 cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake ../
494 cmake-gui
495 cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake ../
496 gedit CMakeCache.txt
497 cmake ..
498 make
499 ls
500 make
501 ls
502 cd ..
503 ls
504 grep -rn lrint_code
505 pwd
506 cd
507 pwd
508 find -name mathinline.h
509 cd ..
510 find -name mathinline.h
511 cd /home/osrc/Desktop/document/arm/opencv-2.4.9
512 ls
513 cd arm-build/
514 ls
515 cd CMakeFiles
516 ls
517 cd ..
518 ls
519 cd toolchain.cmake
520 vi toolchain.cmake
521 ls
522 vi CMakeCache.txt
523 cd bin
524 ls
525 cd ..
526 ls
527 vi Makefile
528 grep -rn include_directories
529 :q
530 :q!
531 ls
532 cmake-gui
533 make
534 find ./ -name link*
535 cat ./modules/gpu/CMakeFiles/opencv_gpu.dir/link.txt
536 cmake-gui
537 ls
538 cat toolchain.cmake
539 find -name CMakeFiles*
540 ls
541 cd .
542 cd ..
543 ls
544 vi CMakeLists.txt
545 gedit CMakeLists.txt
546 cd arm-build/
547 ls
548 gedit CMakeLists.txt
549 cd ..
550 gedit CMakeLists.txt
551 cd arm-build/
552 cmake-gui
553 cmake ..
554 make
555 make -j4
王博解决方案:
491 cd arm-build/
492 gedit toolchain.cmake
493 cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake ../
494 cmake-gui
495 cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake ../
496 gedit CMakeCache.txt
497 cmake ..
498 make
499 ls
500 cd modules/
501 ls
502 cd CMakeFiles/
503 ls
504 cd ..
505 cd higigui
506 cd highgui
507 ls
508 cd CMakeFiles/
509 ls
510 cd opencv_highgui.dir/
511 ls
512 grep "x86_64" * -r
513 vi flags.make
514 ls
515 mv CXX.includecache CXX.includecache.origin
516 rm CXX.includecache.origin
517 ls
518 make
519 grep "Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o" * -r
520 vi build.make
521 ls
522 vi flags.make
523 ls
524 vi /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/arm-linux-gnueabihf/libc/usr/include/math.h
525 vi flags.make
526 ls
527 vi build.make
528 ls
529 vi flags.make
530 pwd
531 ls
532 vi flags.make
533 ls -l
534 cd ..
535 make
536 ls
537 make
在opencv_higui.dir之中寻找相应的文档,更改flags.make文档,与build.make文档与一个aarch的设置有关。
614 cd CMakeFiles/
615 grep "/usr/include/x86_64-linux-gnu" * -r
616 grep "x86_64-linux-gnu" * -r
617 ls
618 cd .
619 cd ..
620 cd modules/
621 ls
622 cd CMakeFiles/
623 grep "/usr/include/x86_64-linux-gnu" * -r
624 grep "x86_64-linux-gnu" * -r
625 ls
626 cd ..
627 ls
628 cd CMakeFiles/
629 ls
630 cd ..
631 ls
632 cd ..
633 ls
634 cd CMakeFiles/
635 ls
636 cd modules
637 ls
638 cd ..
639 cd modules/
640 ls
641 cd CMakeFiles/
642 ls
643 cd ..
644 find . -name highgui
645 cd highgui
646 ls
647 cd CMakeFiles/
648 ls
649 grep "x86_64-linux-gnu" * -r
650 grep "/usr/include/x86_64-linux-gnu" * -r
651 grep "/usr/include/x86_64-linux-gnu" * -r | more
652 ls
653 cd opencv_highgui.dir/
654 ls
655 grep "/usr/include/x86_64-linux-gnu" * -r | more
656 vi flags.make
657 pwd
658 cd ..
659 make
660 ls
661 ls -l
662 make
663 vi /tmp/wy.txt
664 make
665 vi /tmp/wy.txt
666 make
667 cat /tmp/wy.txt
668 make
669 cat /tmp/wy.txt
670 vi /tmp/wy.txt
671 make
672 cat /tmp/wy.txt
673 make
674 ls
675 vi /mnt/workspace/Xilinx/SDK/2017.4/gnu/aarch32/lin/gcc-arm-linux-gnueabi/arm-linux-gnueabihf/libc/usr/include/math.h
676 make
677 ls
678 vi CMakeCache.txt
679 make
680 cd cd /home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui
681 cd /home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui
682 ls
683 /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.cpp
685 history
686 history > wy.txt
687 vi wy.txt
688 /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.cpp
689 /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.cpp
690 /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.cpp
691 /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.cpp
692 /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.cpp
693 history > wy.txt
694 vi wy.txt
695 ls
696 cd ..
697 make
698 ls
699 cd
700 cd /home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui
701 ls
702 vi wy.txt
703 /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.cpp
704 /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.cpp
705 /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.cpp
706 /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.cpp
707 /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.cpp
708 /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.cpp
709 /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.cpp
710 /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.cpp
711 cd /mnt/workspace/
712 ls
713 cd Xilinx/
714 l
715 ls
716 cd SDK
717 ls
718 cd 2017.4/
719 ls
720 cd bin/
721 ls
722 d ..
723 cd ..
724 ls
725 cd gnu/
726 ls
727* cd aarch~
728 cd aarch32
729 ls
730 cd lin/
731 ls
732 cd gcc-arm-linux-gnueabi/
733 ls
734 cd bin/
735 ls
736 ./arm-linux-gnueabihf-gcc -v
737 cd /home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui
738 /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.cpp
739 ls
740 vi wy.txt
741 /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.cpp
742 /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.cpp
743 /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.cpp
744 /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.cpp
745 /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.cpp
746 /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.cpp
747 /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.cpp
748 /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.cpp
749 ls
750 ls CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o
751 ls CMakeFiles/opencv_highgui.dir/src/cap_images.cpp.o -l
752 /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.cpp
753 cd ..
754 make
755 cd /home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build/modules/highgui
756 ls
757 ls -l
758 cd ..
759 ls
760 cd CMakeFiles/
761 ls
762 cd ..
763 cd CMakeFiles/
764 ls
765 cd mo
766 ls
767 pwd
768 ls
769 cd ..
770 cd modules/
771 ls
772 cd highgui/
773 ls
774 cd CMakeFiles/
775 ls
776 cd ..
777 ls
778 cd CMakeFiles/
779 ls
780 cd ..
781 cd higui
782 ls
783 cd highgui
784 ls
785 cd CMakeFiles/
786 ls
787 cd opencv_highgui.dir/
788 ls
789 vi flags.make
790 make
791 pwd
792 vi flags.make
793 ls
794 vi flags.make
795 vi build.make
796 find . -name cap_images*
797 rm src/cap_images.cpp.o
798 LS
799 ls
800 vi build.make
875 make
876 vi modules/nonfree/CMakeFiles/opencv_perf_nonfree.dir/link.txt
877 make
878 vi modules/objdetect/CMakeFiles/opencv_test_objdetect.dir/link.txt
879 make -j4
880 make
881 vi modules/objdetect/CMakeFiles/opencv_perf_objdetect.dir/link.txt
882 make
883 vi modules/objdetect/CMakeFiles/opencv_test_objdetect.dir/link.txt
884 make
885 vi modules/photo/CMakeFiles/opencv_test_photo.dir/link.txt
886 make -j4
887 vi modules/photo/CMakeFiles/opencv_perf_photo.dir/link.txt
888 make -j4
889 vi modules/stitching/CMakeFiles/opencv_perf_stitching.dir/link.txt
890 vi modules/stitching/CMakeFiles/opencv_test_stitching.dir/link.txt
891 make -j4
892 history
此步出错在于编译器找不到相应的文件,所以我们需要在相应的CMakeFiles之中添加下面的东西。位置 arm/opencv-2.4.9/arm-build/modules/highgui/CMakeFiles/opencv-highgui.dir,,这个文件制定了相应的路径。我们在后面添加依赖路径,注意语法,前后冒号。
799 ls
800 vi build.make
801 history
802 cd /home/osrc/Desktop/document/arm/opencv-2.4.9/arm-build
803 ls
804 cd modules/highgui/CMakeFiles/opencv_highgui.dir/build.make
805 cd modules/highgui/CMakeFiles/opencv_highgui.dir/
806 vi build.make
807 cp link.txt ../link.txt
808 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
参考: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之后才有此步)
gedit /etc/bash.bashrc
在最后一行加入:注意路径要与自己的一致。PKG_CONFIG_PATH=$PKG_CONFIG_PATH:
/home/osrc/Desktop/document/arm/opencv-install/lib/pkgconfigexport PKG_CONFIG_PATH
如图
然后 source /etc/bash.bashrc
创建并编辑test.cpp文件
#include
#include
#include
using namespace std;
int main(int argc, char *argv[])
{
IplImage* image = cvLoadImage("/root/Desktop/miska.jpg");
if(image == NULL)
{
cout<<"loud image fail"<
保存并退出之后,输入如下:
arm-linux-gnueabihf-g++ `pkg-config --cflags --libs opencv` test.cpp -lpthread -lrt -o test
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文件夹。
然后编译,解决了相应的找不到头文件的问题。
/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,好在终于完成了运行。
在运行时,还要把arm/opencv-install/lib目录下的所有.so文件都拷贝到arm的/usr/lib或者/lib目录下。
详细运行步骤见:ARM单片机编译与运行程序MTCNN https://blog.csdn.net/weixin_36474809/article/details/83342549