Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. OpenCV with CMake config failed
Forum Updated to NodeBB v4.3 + New Features

OpenCV with CMake config failed

Scheduled Pinned Locked Moved Solved Mobile and Embedded
3 Posts 2 Posters 579 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Ivelin
    wrote on 30 Jan 2024, 23:40 last edited by
    #1

    Hello,

    I am trying to use OpenCV in order to take pictures of the front camera in Qt, but I have trouble with the CMake configuration and most likely hadbuilt OpenCV incorrectly.

    I have followed exactly this guide ( the example ) to built OpenCV with no errors - https://docs.opencv.org/4.x/d0/d76/tutorial_arm_crosscompile_with_cmake.html

    In my CMake file I have a lot of code that I will not show because I do not think it is necessary.

    CMakeLists.txt

    ..
            find_package(OpenCV REQUIRED)
            target_link_libraries(androidnotifier PRIVATE Qt6::Multimedia Qt6::Widgets Qt6::Core Qt6::CorePrivate ${OpenCV_LIBS})
    ..
    

    However, after those commands:

    cmake -DCMAKE_TOOLCHAIN_FILE=/home/ivelin/Qt/6.2.4/android_arm64_v8a/lib/cmake/Qt6/qt.toolchain.cmake .
    make
    
    adb install -r android-build/androidnotifier.apk
    

    I get

    [ 70%] Linking CXX shared module libandroidnotifier_arm64-v8a.so
    ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_gapi.so.4.9.0 is incompatible with aarch64linux
    ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_highgui.so.4.9.0 is incompatible with aarch64linux
    ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_ml.so.4.9.0 is incompatible with aarch64linux
    ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_objdetect.so.4.9.0 is incompatible with aarch64linux
    ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_photo.so.4.9.0 is incompatible with aarch64linux
    ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_stitching.so.4.9.0 is incompatible with aarch64linux
    ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_video.so.4.9.0 is incompatible with aarch64linux
    ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_videoio.so.4.9.0 is incompatible with aarch64linux
    ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_imgcodecs.so.4.9.0 is incompatible with aarch64linux
    ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_dnn.so.4.9.0 is incompatible with aarch64linux
    ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_calib3d.so.4.9.0 is incompatible with aarch64linux
    ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_features2d.so.4.9.0 is incompatible with aarch64linux
    ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_flann.so.4.9.0 is incompatible with aarch64linux
    ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_imgproc.so.4.9.0 is incompatible with aarch64linux
    ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_core.so.4.9.0 is incompatible with aarch64linux
    clang++: error: linker command failed with exit code 1 (use -v to see invocation)
    

    Why is that ? Could someone please take a look ?

    J 1 Reply Last reply 31 Jan 2024, 07:32
    0
    • I Ivelin
      30 Jan 2024, 23:40

      Hello,

      I am trying to use OpenCV in order to take pictures of the front camera in Qt, but I have trouble with the CMake configuration and most likely hadbuilt OpenCV incorrectly.

      I have followed exactly this guide ( the example ) to built OpenCV with no errors - https://docs.opencv.org/4.x/d0/d76/tutorial_arm_crosscompile_with_cmake.html

      In my CMake file I have a lot of code that I will not show because I do not think it is necessary.

      CMakeLists.txt

      ..
              find_package(OpenCV REQUIRED)
              target_link_libraries(androidnotifier PRIVATE Qt6::Multimedia Qt6::Widgets Qt6::Core Qt6::CorePrivate ${OpenCV_LIBS})
      ..
      

      However, after those commands:

      cmake -DCMAKE_TOOLCHAIN_FILE=/home/ivelin/Qt/6.2.4/android_arm64_v8a/lib/cmake/Qt6/qt.toolchain.cmake .
      make
      
      adb install -r android-build/androidnotifier.apk
      

      I get

      [ 70%] Linking CXX shared module libandroidnotifier_arm64-v8a.so
      ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_gapi.so.4.9.0 is incompatible with aarch64linux
      ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_highgui.so.4.9.0 is incompatible with aarch64linux
      ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_ml.so.4.9.0 is incompatible with aarch64linux
      ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_objdetect.so.4.9.0 is incompatible with aarch64linux
      ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_photo.so.4.9.0 is incompatible with aarch64linux
      ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_stitching.so.4.9.0 is incompatible with aarch64linux
      ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_video.so.4.9.0 is incompatible with aarch64linux
      ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_videoio.so.4.9.0 is incompatible with aarch64linux
      ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_imgcodecs.so.4.9.0 is incompatible with aarch64linux
      ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_dnn.so.4.9.0 is incompatible with aarch64linux
      ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_calib3d.so.4.9.0 is incompatible with aarch64linux
      ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_features2d.so.4.9.0 is incompatible with aarch64linux
      ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_flann.so.4.9.0 is incompatible with aarch64linux
      ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_imgproc.so.4.9.0 is incompatible with aarch64linux
      ld: error: /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_core.so.4.9.0 is incompatible with aarch64linux
      clang++: error: linker command failed with exit code 1 (use -v to see invocation)
      

      Why is that ? Could someone please take a look ?

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 31 Jan 2024, 07:32 last edited by
      #2

      @Ivelin said in OpenCV with CMake config failed:

      Why is that ?

      Because the OpenCV libraries you're using are not aarch64linux as the error messages say. For what platform OpenCV libs you're using were built (you can check with command "file /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_gapi.so.4.9.0".

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      I 1 Reply Last reply 31 Jan 2024, 19:26
      1
      • J jsulm
        31 Jan 2024, 07:32

        @Ivelin said in OpenCV with CMake config failed:

        Why is that ?

        Because the OpenCV libraries you're using are not aarch64linux as the error messages say. For what platform OpenCV libs you're using were built (you can check with command "file /home/ivelin/opencv/platforms/linux/build_hardpf/lib/libopencv_gapi.so.4.9.0".

        I Offline
        I Offline
        Ivelin
        wrote on 31 Jan 2024, 19:26 last edited by
        #3

        @jsulm, yes I had to use the aarch64-gnu.toolchain.cmake file which is in opencv/platforms/linux

        1 Reply Last reply
        0
        • I Ivelin has marked this topic as solved on 31 Jan 2024, 19:26

        1/3

        30 Jan 2024, 23:40

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved