Important: Please read the Qt Code of Conduct -

Problem with OpenCV after updates to 4.0.1

  • Hi everyone!

    I'm updated the OpenCV on my Mac with brew to 4.0.1 version and now when I'm build my project I'm receiving this error:

    Library not loaded: /usr/local/opt/opencv/lib/libopencv_stitching.3.4.dylib
      Referenced from: /Volumes/HPDD/Applications/Qt/Qt5.x/5.12.0/clang_64/qml/ShavComponents/libShavComponents_debug.dylib
      Reason: image not found)

    When I saw this error in first time I'm checked the path and didn't find the library and this is correct because I'm updated OpenCV to 4.0.1. My question is how I can set version of OpenCV if my integration in pro file looks like this:

    QT_CONFIG -= no-pkg-config
    CONFIG += link_pkgconfig
    PKGCONFIG += opencv4
    INCLUDEPATH += /usr/local/Cellar/opencv/4.0.1/include/

    By the way, my project is building correctly but can not start because library which my application trying load doesn't exists. How I can fix this?

  • Lifetime Qt Champion


    Try adding the DYLD_LIBRARY_PATH environment variable to the Run part of the Project panel.
    Put /usr/local/opt/opencv/lib/ as its value.

    You can also run otool -L /usr/local/opt/opencv/lib/libopencv_stitching.3.4.dylib and compare the output of the same call to the equivalent library of OpenCV 3.

  • Thank you @SGaist! Your solution is works for me!

Log in to reply