CMake search for package opencv in Linux 6.1.1-1.0.0 broken ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CMake search for package opencv in Linux 6.1.1-1.0.0 broken ?

Jump to solution
844 Views
edouard_charvet
Contributor III

Hello,

I'm having a cmake project importing the OpenCV libs from the Yocto Linux SDK using the following CMake statement:

find_package( OpenCV REQUIRED)
 
In the Linux SDK for version 5.15.71_2.2.0 (for image imx-image-multimedia), everything works fine.
I tried migrating to Linux SDK for version 6.1.1_1.0.0 and it doesn't work anymore. With the SDK for image imx-image-multimedia I get the following error:
 
CMake Error at sysroots/armv8a-poky-linux/usr/lib/cmake/opencv4/OpenCVModules.cmake:453 (message):
[cmake] The imported target "opencv_flann.so" references the file
[cmake]
[cmake] "/home/edouard/imx8_sdks/imx-image-full_6.1.1-1.0.0/sysroots/armv8a-poky-linux/usr/lib/libopencv_ts.so.4.6.0"
[cmake]
[cmake] but this file does not exist.
 
and trying with the SDK for image imx-image-full, I get the following error:
 
CMake Error at sysroots/armv8a-poky-linux/usr/lib/cmake/opencv4/OpenCVModules.cmake:453 (message):
[cmake] The imported target "opencv_ts" references the file
[cmake]
[cmake] "/home/edouard/imx8_sdks/imx-image-full_6.1.1-1.0.0/sysroots/armv8a-poky-linux/usr/lib/libopencv_ts.so.4.6.0"
[cmake]
[cmake] but this file does not exist.
 
Indeed the complaining libs are not in the SDKs anymore...
How should I solve this ?
Thanks,
Edouard
0 Kudos
1 Solution
711 Views
alberto_alvarez
NXP Employee
NXP Employee

Hello @edouard_charvet,

Indeed, the SDK fails to correctly find the necessary files to build with OpenCV. As a temporary fix, you could try moving the following, which worked on my side:

  1. Log mentions that /sysroots/armv8a-poky-linux/usr/lib/libopencv_ts.so.4.6.0 cannot be found. In my SDK, when searching for it with find tool, it is located inside /sysroots/armv8a-poky-linux/usr/lib/.debug/libopencv_ts.so.4.7.0 (I have version 4.7.0, but should be similar case).  I just created a copy of it to /sysroots/armv8a-poky-linux/usr/lib, which is the path expected by cmake. Notice I copied it, not moved it, since I do not want to break the .debug path.
  2. Fixing that required me to then move /sysroots/armv8a-poky-linux/usr/lib/.debug/libopencv_superres.so.4.7.0 to /sysroots/armv8a-poky-linux/usr/lib

Having those two *.so in that path fixed the issue. Hope this helps for now.

Regards,

Alberto

View solution in original post

0 Kudos
4 Replies
712 Views
alberto_alvarez
NXP Employee
NXP Employee

Hello @edouard_charvet,

Indeed, the SDK fails to correctly find the necessary files to build with OpenCV. As a temporary fix, you could try moving the following, which worked on my side:

  1. Log mentions that /sysroots/armv8a-poky-linux/usr/lib/libopencv_ts.so.4.6.0 cannot be found. In my SDK, when searching for it with find tool, it is located inside /sysroots/armv8a-poky-linux/usr/lib/.debug/libopencv_ts.so.4.7.0 (I have version 4.7.0, but should be similar case).  I just created a copy of it to /sysroots/armv8a-poky-linux/usr/lib, which is the path expected by cmake. Notice I copied it, not moved it, since I do not want to break the .debug path.
  2. Fixing that required me to then move /sysroots/armv8a-poky-linux/usr/lib/.debug/libopencv_superres.so.4.7.0 to /sysroots/armv8a-poky-linux/usr/lib

Having those two *.so in that path fixed the issue. Hope this helps for now.

Regards,

Alberto

0 Kudos
681 Views
edouard_charvet
Contributor III

Hello @alberto_alvarez,

Thanks for posting this workaround, it also works for me.

Hope this gets properly fixed in subsequent releases of yocto...

Edouard

0 Kudos
811 Views
brian14
NXP TechSupport
NXP TechSupport

Hi @edouard_charvet

To solve this problem, you could try to update your OpenCV version to the newest version for NXP OpenCV (4.6.0), also you can try to update the cmake search paths in the cmake script identifying the changes between those versions and check that al the libraries are present in the new OpenCV.

You can use this link to review the difference between new and older version:

GitHub - nxp-imx/opencv-imx: i.MX OpenCV

I hope this information will be helpful. 

Have a great day!

Best regards, Brian. 

0 Kudos
45 Views
hlarouss
Contributor I

Hello,

I confirm that the solution proposed of moving the two faulty library files from usr/lib/.debug to usr/lib works fine.

However, I just updated my OpenCV version to 4.8.1 (using the recipe obtained from the meta-imx github repo: https://github.com/nxp-imx/meta-imx) and I can confirm that this problem is still present.

Kind Regards,

Houssem

0 Kudos