I use Yocto 4.9.88(rock 2.4) BSP and bitbake opencv without modifying any files, the mission is complete.
Now I want to use opencv called by python, so I add two PACKAGECONFIG python2 & python3 in opencv_3.4.bb
and remove PACKAGECONFIG_remove_imx = "eigen python3" in opencv_3.4.bbappend.
The build is failed this time.
The error message is as below
| [ 8%] Built target IlmImf
| make: Leaving directory '/ACS_Disk2/MS5776/20191226/imx-yocto-bsp/imx-linux-rocko/MS5776_V107/tmp/work/cortexa9hf-neon-mx6qdl-poky-linux-gnueabi/opencv/3.4+gitAUTOINC+6d4f66472e_81ca8dab86_a62e20676a_34e4206aef_fccf7cd6a4-r0/build'
| Makefile:165: recipe for target 'all' failed
| make: *** [all] Error 2
| WARNING: exit code 2 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /ACS_Disk2/MS5776/20191226/imx-yocto-bsp/imx-linux-rocko/MS5776_V107/tmp/work/cortexa9hf-neon-mx6qdl-poky-linux-gnueabi/opencv/3.4+gitAUTOINC+6d4f66472e_81ca8dab86_a62e20676a_34e4206aef_fccf7cd6a4-r0/temp/log.do_compile.7712)
ERROR: Task (/ACS_Disk2/MS5776/20191226/imx-yocto-bsp/imx-linux-rocko/sources/meta-fsl-bsp-release/imx/meta-bsp/recipes-graphics/opencv/opencv_3.4.bb:do_compile) failed with exit code '1'
Could anyone tell me what happened? And how do I fix it?
updated in 2020/01/30
I used "bitbake -D opencv" and found the error message :
make: *** No rule to make target 'modules/dnn/attr_value.pb.cc', needed by 'modules/python_bindings_generator/pyopencv_generated_include.h'
And I tried to follow the steps from No rule to make target 'modules/dnn/attr_value.pb.cc' · Issue #10474 · opencv/opencv · GitHub
But I have not found a way to build opencv_dnn first in Yocto BSP yet.
I still used Yocto 4.9.88(rock 2.4) BSP and updated the OpenCV to v4.0.1(from imx-yocto-L4.14.98_2.3.0), then I enabled python3, OpenCL, dnn and text.
Finally, I built it successfully.
But I tested the source code as below
img = cv2.UMat(cv2.imread("image.jpg", cv2.IMREAD_COLOR))
imgUMat = cv2.UMat(img)
gray = cv2.cvtColor(imgUMat, cv2.COLOR_BGR2GRAY)
gray = cv2.GaussianBlur(gray, (7, 7), 1.5)
gray = cv2.Canny(gray, 0, 50)
cv2.imwrite('test_UMat.jpg' , imgUMat)
it reported an error from OpenCL
[ WARN:0] Using world accessible cache directory. This may be not secure: /var/tmp/
OpenCL error CL_INVALID_WORK_GROUP_SIZE (-54) during call: clEnqueueNDRangeKernel('row_filter_C1_D0', dims=2, globalsize=128x528x1, localsize=16x16x1) sync=false
[ 1] 25: FMA_MUL temp(322).dp.x, 2.000000, temp(319).dp.x
I also tested the code in OpenCV v3.4, it worked and no error.
Could you tell me what happened and how to fix it?
Hello Zohan Lin,
I'm glad to hear that you were able to build it on a newer BSP. (Some older BSPs are having problems especially with repositories having been moved).
However, I would need to ask you to please branch your question to a new thread (or open a new thread) as it's more related to the actual an OpenCV implementation and not building it in Yocto, and this will also give it more visibility.