Cross-compiling OpenCV 3 for Raspberry Pi 2

Sysprogs forums Forums VisualGDB Cross-compiling OpenCV 3 for Raspberry Pi 2

This topic contains 3 replies, has 2 voices, and was last updated by  support 6 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #22342



    I have followed the instructions in above tutorial at for opncv-3.4.1.

    On step 8 I have noticed that gtk was not found. After watching the log I have found a message  stating that package-config was disabled, and followed the recommendation to add

    PKG_CONFIG_LIBDIR=C:/SysGCC/Raspberry/arm-linux-gnueabihf/sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig;C:/SysGCC/Raspberry/arm-linux-gnueabihf/sysroot/usr/share/pkgconfig (as for the path) to the environment section configuration.

    This solved the problem and gtk3 was found and build went OK.

    However, unlike in the tutorial screenshot where 3 successful builds are shown, I got only 1 and 0 failed.

    I wanted to continue to step 10 of the process, however I can’t find the OpenCV build directory mentioned in the tutorial and continue with the make install step.

    Please advise.

    Thank you,

    Nahum Budin.




    Deleted the project and restarted all over, this time the build directory was there (must have been a settings I have missed 🙁 ).

    (while setting the CMake command configuration, a VS bug was identified- toggling tabs!?.

    A ticket was opened with screenshots and video – see the attached. A workaround is to close the CMake Command tab and reopen it – please add this info to the ticket).

    Then, when running the make install command, a Microsoft make tool was executed, though the path was updated as specified.

    A workaround – using the full path of make: C:\SysGCC\Raspberry\bin\make install.

    Next steps of the tutorial to be followed soon…



    You must be logged in to view attached files.


    Final update.

    Continued with the tutorial sample program.

    When running, got an error message that libjasper cannot be found.

    Solution: make sure to install all required libraries on  your Raspberry Pi:

    sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
    sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
    sudo apt-get install libxvidcore-dev libx264-dev
    sudo apt-get install libgtk2.0-dev libgtk-3-dev.

    Next a new error was reported:

    WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files

    Solution: sudo apt-get install at-spi2-core.

    Finally the demo runs well from the debugger.

    Now trying to run the executable directly on the Raspi yield a file not found error.

    Reason: no command line parameters are available.

    Solution: change default file name in the main section:

    /// Load source image
    String imageName(“/home/pi/Lena.png”); // by default

    Now it runs directly on/from the Raspi. 🙂

    My 2 cents.




    • This reply was modified 6 months ago by  nahumb.



    Thanks for sharing this. We have just finished rechecking everything with the latest OpenCV release and the latest Raspberry Pi toolchain and updated the tutorial.

    We have also added a few usability features to VisualGDB (e.g. automatic deployment of installed CMake targets), so please use this build if you would like to try the new features.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.