1. <small id='AJmNZ'></small><noframes id='AJmNZ'>

    2. <legend id='AJmNZ'><style id='AJmNZ'><dir id='AJmNZ'><q id='AJmNZ'></q></dir></style></legend>

        <tfoot id='AJmNZ'></tfoot>
        <i id='AJmNZ'><tr id='AJmNZ'><dt id='AJmNZ'><q id='AJmNZ'><span id='AJmNZ'><b id='AJmNZ'><form id='AJmNZ'><ins id='AJmNZ'></ins><ul id='AJmNZ'></ul><sub id='AJmNZ'></sub></form><legend id='AJmNZ'></legend><bdo id='AJmNZ'><pre id='AJmNZ'><center id='AJmNZ'></center></pre></bdo></b><th id='AJmNZ'></th></span></q></dt></tr></i><div id='AJmNZ'><tfoot id='AJmNZ'></tfoot><dl id='AJmNZ'><fieldset id='AJmNZ'></fieldset></dl></div>
          <bdo id='AJmNZ'></bdo><ul id='AJmNZ'></ul>

        在 Ubuntu 上为 Raspberry Pi 交叉编译 opencv 项目

        Cross compile opencv project on Ubuntu for Raspberry Pi(在 Ubuntu 上为 Raspberry Pi 交叉编译 opencv 项目)
        <legend id='xueZ7'><style id='xueZ7'><dir id='xueZ7'><q id='xueZ7'></q></dir></style></legend>

            • <bdo id='xueZ7'></bdo><ul id='xueZ7'></ul>
              • <tfoot id='xueZ7'></tfoot>

                <small id='xueZ7'></small><noframes id='xueZ7'>

                    <tbody id='xueZ7'></tbody>
                1. <i id='xueZ7'><tr id='xueZ7'><dt id='xueZ7'><q id='xueZ7'><span id='xueZ7'><b id='xueZ7'><form id='xueZ7'><ins id='xueZ7'></ins><ul id='xueZ7'></ul><sub id='xueZ7'></sub></form><legend id='xueZ7'></legend><bdo id='xueZ7'><pre id='xueZ7'><center id='xueZ7'></center></pre></bdo></b><th id='xueZ7'></th></span></q></dt></tr></i><div id='xueZ7'><tfoot id='xueZ7'></tfoot><dl id='xueZ7'><fieldset id='xueZ7'></fieldset></dl></div>
                2. 本文介绍了在 Ubuntu 上为 Raspberry Pi 交叉编译 opencv 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我现在为此苦苦挣扎了 2 天,但没有让它发挥作用.

                  I'm struggling with this for 2 days now and don't get it to work.

                  到目前为止我所做的:

                  • 在 Ubuntu 12.04 LTS 上从源代码构建 opencv 2.4.8--> OpenCV项目在ubuntu上编译运行

                  • built opencv 2.4.8 from source on Ubuntu 12.04 LTS --> OpenCV projects compile and run on ubuntu

                  从树莓派 Raspian 上的源代码构建 opencv 2.4.8--> OpenCV项目在树莓派上编译运行

                  built opencv 2.4.8 from source on the Raspberry Pi Raspian --> OpenCV projects compile and run on the Raspberry Pi

                  使用 crosstools-ng 为 Raspberry Pi 构建了一个交叉编译器(http://www.bootc.net/archives/2012/05/26/how-to-build-a-cross-compiler-for-你的树莓派/)--> 在 Ubuntu 上构建的 C++ 程序和在树莓派上运行的交叉编译器

                  built a cross compiler for the Raspberry Pi with crosstools-ng (http://www.bootc.net/archives/2012/05/26/how-to-build-a-cross-compiler-for-your-raspberry-pi/) --> c++ programs built on Ubuntu with the crosscompiler run on the Raspberry Pi

                  我的问题是什么:

                3. OpenCV 程序不能使用交叉编译器进行编译
                4. |2|fatal error: opencv2/highgui/highgui.hpp: No such file or directory|
                  

                5. 我想我也需要在 ubuntu 上交叉编译 OpenCV.从我的交叉编译器我也有一个工具链
                6. # this one is important
                  SET(CMAKE_SYSTEM_NAME Linux)
                  #this one not so much
                  SET(CMAKE_SYSTEM_VERSION 1)
                  
                  # specify the cross compiler
                  SET(CMAKE_C_COMPILER
                  /home/christian/Programming/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc)
                  
                  SET(CMAKE_CXX_COMPILER
                  /home/christian/Programming/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-g++)
                  
                  # where is the target environment
                  SET(CMAKE_FIND_ROOT_PATH
                  /home/christian/Programming/x-tools/arm-unknown-linux-gnueabi)
                  
                  # search for programs in the build host directories
                  SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
                  # for libraries and headers in the target directories
                  SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
                  SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
                  

                  使用此工具链,我尝试使用此命令交叉编译 OpenCV:

                  with this toolchain I tried to cross compile OpenCV with this command:

                  cmake -DCMAKE_TOOLCHAIN_FILE=../Toolchain-RaspberryPi.cmake ../
                  

                  在 make 命令之后,它编译到 27%.在那里它停止了这个错误

                  After the make command it compiles until 27%. There it stops with this error

                  [ 27%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o
                  In file included from /home/christian/Downloads/opencv-2.4.8/modules/highgui/src/cap_ffmpeg_impl.hpp:60:0,
                                   from /home/christian/Downloads/opencv-2.4.8/modules/highgui/src/cap_ffmpeg.cpp:45:
                  /home/christian/Downloads/opencv-2.4.8/modules/highgui/src/ffmpeg_codecs.hpp:81:36: fatal error: libavformat/avformat.h: No such file or directory
                     #include <libavformat/avformat.h>
                                                      ^
                  compilation terminated.
                  make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o] Error 1
                  make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
                  make: *** [all] Error 2
                  

                7. 我尝试将在 Raspberry Pi 上编译的 OpenCV 头文件和库复制到我的 ubuntu 计算机并链接它们.编译时出现大量错误
                8. ||=== RPi_Cross_CV, Debug ===|
                  ||warning: libz.so.1, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_core.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libjpeg.so.8, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libpng12.so.0, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libtiff.so.4, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libjasper.so.1, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libgtk-x11-2.0.so.0, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libgdk-x11-2.0.so.0, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libatk-1.0.so.0, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libgio-2.0.so.0, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libpangoft2-1.0.so.0, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libpangocairo-1.0.so.0, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libgdk_pixbuf-2.0.so.0, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libcairo.so.2, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libpango-1.0.so.0, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libfreetype.so.6, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libfontconfig.so.1, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libgobject-2.0.so.0, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libglib-2.0.so.0, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libgthread-2.0.so.0, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libgstbase-0.10.so.0, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libgstreamer-0.10.so.0, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libgmodule-2.0.so.0, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libxml2.so.2, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libdc1394.so.22, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libv4l1.so.0, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libavcodec.so.53, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libavformat.so.53, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libavutil.so.51, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ||warning: libswscale.so.2, needed by ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8, not found (try using -rpath or -rpath-link)|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `TIFFSetWarningHandler@LIBTIFF_3.9'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `png_read_info@PNG12_0'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `g_time_val_add'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `jas_image_writecmpt'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `gtk_widget_queue_draw'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `av_guess_codec@LIBAVFORMAT_53'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `av_rescale_q@LIBAVUTIL_51'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `jpeg_std_error@LIBJPEG_8.0'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `jas_cmprof_destroy'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `png_get_tRNS@PNG12_0'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `g_return_if_fail_warning'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `dc1394_camera_enumerate'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `dc1394_capture_stop'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `compress'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `dc1394_get_image_size_from_video_mode'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `g_timeout_add'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `png_set_packing@PNG12_0'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `v4l2_munmap'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `dc1394_feature_whitebalance_get_value'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `gtk_type_new'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `jas_image_destroy'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `avcodec_close@LIBAVCODEC_53'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `sws_getCachedContext@LIBSWSCALE_2'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_core.so.2.4.8||undefined reference to `gzeof'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `gtk_style_attach'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `gtk_widget_get_type'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `gtk_window_resize'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `g_cond_broadcast'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `dc1394_video_get_supported_framerates'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `jpeg_read_header@LIBJPEG_8.0'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `avio_open@LIBAVFORMAT_53'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `TIFFReadEncodedTile@LIBTIFF_3.9'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `uncompress'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `g_type_check_instance_cast'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `g_usleep'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `avcodec_find_decoder@LIBAVCODEC_53'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `g_get_current_time'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `jpeg_set_defaults@LIBJPEG_8.0'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `dc1394_video_get_mode'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `jpeg_start_compress@LIBJPEG_8.0'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `av_free_packet@LIBAVCODEC_53'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `gtk_window_set_geometry_hints'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `gtk_signal_connect_full'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `gdk_draw_rgb_image'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `gtk_widget_queue_resize'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `dc1394_video_set_mode'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `jas_stream_close'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `jpeg_set_quality@LIBJPEG_8.0'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `jas_image_readcmpt'|
                  ../../../../Programming/x-tools/usr-local/lib/libopencv_highgui.so.2.4.8||undefined reference to `gtk_disable_setlocale'|
                  ||More errors follow but not being shown.|
                  ||Edit the max errors limit in compiler options...|
                  ||=== Build finished: 50 errors, 29 warnings ===|
                  

                  <小时>

                  所以我的问题是:

                  如何让 ubuntu 上的交叉编译器与 opencv 一起工作?我只想在 ubuntu 上编译,在 Pi 上复制程序并在那里运行.

                  How can I get a crosscompiler on ubuntu to work with opencv? I just want to compile on ubuntu, copy the program on the Pi and run it there.

                  非常感谢

                  推荐答案

                  我意识到这是一个老问题,但作为记录,我能够从 Ubuntu 交叉编译我的 OpenCV 项目.

                  I realize this is an old question but for the record I was able to cross compile my OpenCV project from Ubuntu.

                  就我而言,我使用了 github 上预先构建的 raspberry pi 工具链:https://github.com/raspberrypi/tools 在 Ubuntu 12.0.4 上.我采用了将本地库(安装了 OpenCV 和 PiCamera 库)从目标 Raspberry Pi 系统复制到 Ubuntu 实例的方法,并使用了您在帖子中提到的 CMAKE_TOOLCHAIN_FILE 支持.

                  In my case I used the the pre-built raspberry pi toolchain on github: https://github.com/raspberrypi/tools on Ubuntu 12.0.4. I took the approach of copying the native libraries (with OpenCV and PiCamera libraries installed) from the target Raspberry Pi system to the Ubuntu instance and using the CMAKE_TOOLCHAIN_FILE support like you mention in your post.

                  但是,我必须克服某些问题,我在这篇文章中介绍了这些问题:https://solderspot.wordpress.com/2016/02/04/cross-compiling-for-raspberry-pi-part-ii

                  However, there were certain issues I had to overcome, which I cover in this post: https://solderspot.wordpress.com/2016/02/04/cross-compiling-for-raspberry-pi-part-ii

                  关键点是:

                  1. CMAKE_FIND_ROOT_PATH 没有效果.我不得不使用 CMAKE_SYSROOT.

                  1. CMAKE_FIND_ROOT_PATH had not effect. I had to use CMAKE_SYSROOT.

                  在我的 CMakeLists.txt 文件中,我仍然必须明确地在任何路径前面加上我通过本机文件系统复制的文件夹的路径.

                  In my CMakeLists.txt file I still had to explicitly prepend any paths with the path to the folder where I had copied over the native file system.

                  我还需要在 CMAKE_TOOLCHAIN_FILE 中明确指定动态库链接路径,因为工具链没有正确解析/usr/etc/ld.so.conf 文件.

                  I also needed to explicitly specify the dynamic library link paths from within CMAKE_TOOLCHAIN_FILE as the toolchain does not correctly parser the /usr/etc/ld.so.conf file.

                  我目前唯一无法解决的问题是 Raspbian 的 Jessie 版本,因为 OpenCV 使用了 gcc/g++ 4.9 版本的工具链不支持的 gcc/g++ 4.9 功能.看起来工具链将在不久的将来得到增强以支持 4.9.

                  The only current issue I could not solve yet was to do with the Jessie release of Raspbian, as OpenCV uses an gcc/g++ 4.9 feature that is not supported by the gcc/g++ 4.8 version of the toolchain. It looks like the toolchain will be augmented to support 4.9 in the near future.

                  我的最终 CMAKE_TOOLCHAIN_FILE 是:

                  My final CMAKE_TOOLCHAIN_FILE was:

                  SET(CMAKE_SYSTEM_NAME Linux)
                  SET(CMAKE_SYSTEM_VERSION 1)
                  
                  SET(DEVROOT $ENV{HOME}/pidev)
                  SET(PIROOT ${DEVROOT}/piroot)
                  SET(PITOOLS ${DEVROOT}/pitools)
                  
                  SET(TOOLROOT ${PITOOLS}/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64)
                  
                  # specify the cross compiler
                  SET(CMAKE_C_COMPILER   ${TOOLROOT}/bin/arm-linux-gnueabihf-gcc)
                  SET(CMAKE_CXX_COMPILER ${TOOLROOT}/bin/arm-linux-gnueabihf-g++)
                  
                  SET(FLAGS "-Wl,-rpath-link,${PIROOT}/opt/vc/lib -Wl,-rpath-link,${PIROOT}/lib/arm-linux-gnueabihf -Wl,-rpath-link,${PIROOT}/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,${PIROOT}/usr/local/lib")
                  
                  UNSET(CMAKE_C_FLAGS CACHE)
                  UNSET(CMAKE_CXX_FLAGS CACHE)
                  
                  SET(CMAKE_CXX_FLAGS ${FLAGS} CACHE STRING "" FORCE)
                  SET(CMAKE_C_FLAGS ${FLAGS} CACHE STRING "" FORCE)
                  
                  SET(CMAKE_SYSROOT ${PIROOT})
                  SET(CMAKE_FIND_ROOT_PATH ${PIROOT})
                  
                  
                  # search for programs in the build host directories
                  SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
                  # for libraries and headers in the target directories
                  SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
                  SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
                  

                  我的主目录中有一个 pidev 文件夹,在该文件夹下 piroot 有一个来自我的 pi 主机的/usr/opt/etc 和/lib 的副本,并且pitools 是我上面引用的 GitHub 工具链的克隆.

                  Where I had a pidev folder in my home directory and under that piroot had a copy of /usr /opt /etc and /lib from my pi host, and pitools is a clone of the toolchain from GitHub I reference above.

                  我的项目的 CMakeLists.txt 文件是:

                  My CMakeLists.txt file for my project was:

                  cmake_minimum_required(VERSION 2.8)
                  project( PiCamCVTest )
                  SET(COMPILE_DEFINITIONS -Werror)
                  
                  include_directories(SYSTEM ${PIROOT}/opt/vc/include ${PIROOT}/opt/vc/include/interface/vcos/pthreads ${PIROOT}/opt/vc/include/interface/vmcs_host/linux )
                  link_directories( ${PIROOT}/opt/vc/lib )
                  add_executable(PiCamCVTest main.cpp camera.cpp cameracontrol.cpp graphics.cpp)
                  
                  target_link_libraries(PiCamCVTest libmmal_core.so libmmal_util.so libmmal_vc_client.so libvcos.so librt.so libbcm_host.so GLESv2 EGL libopencv_core.so libopencv_imgproc.so)
                  

                  希望这会有所帮助.

                  这篇关于在 Ubuntu 上为 Raspberry Pi 交叉编译 opencv 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  C++ stl unordered_map implementation, reference validity(C++ stl unordered_map 实现,参考有效性)
                  C++: Is it possible to use a reference as the value in a map?(C++:是否可以使用引用作为映射中的值?)
                  Where ampersand quot;amp;quot; can be put when passing argument by reference?(其中符号“amp;通过引用传递参数时可以放置吗?)
                  Why can a non-const reference parameter be bound to a temporary object?(为什么可以将非常量引用参数绑定到临时对象?)
                  What is a dangling reference?(什么是悬空引用?)
                  C++ reference changes when push_back new element to std::vector(当 push_back 新元素到 std::vector 时,C++ 引用发生变化)

                  • <small id='1h7Bh'></small><noframes id='1h7Bh'>

                    <i id='1h7Bh'><tr id='1h7Bh'><dt id='1h7Bh'><q id='1h7Bh'><span id='1h7Bh'><b id='1h7Bh'><form id='1h7Bh'><ins id='1h7Bh'></ins><ul id='1h7Bh'></ul><sub id='1h7Bh'></sub></form><legend id='1h7Bh'></legend><bdo id='1h7Bh'><pre id='1h7Bh'><center id='1h7Bh'></center></pre></bdo></b><th id='1h7Bh'></th></span></q></dt></tr></i><div id='1h7Bh'><tfoot id='1h7Bh'></tfoot><dl id='1h7Bh'><fieldset id='1h7Bh'></fieldset></dl></div>
                    <legend id='1h7Bh'><style id='1h7Bh'><dir id='1h7Bh'><q id='1h7Bh'></q></dir></style></legend>

                        <tfoot id='1h7Bh'></tfoot>
                          <bdo id='1h7Bh'></bdo><ul id='1h7Bh'></ul>
                            <tbody id='1h7Bh'></tbody>