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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
983 次查看
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 项奖励
1 解答
850 次查看
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 项奖励
4 回复数
851 次查看
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 项奖励
820 次查看
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 项奖励
950 次查看
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 项奖励
184 次查看
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 项奖励