From 7462ae5636ebd8551350253d2bb1c3047431ba0d Mon Sep 17 00:00:00 2001 From: Tom Hochstein Date: Tue, 4 May 2021 10:49:07 -0500 Subject: opencv: Fix SRC_URI The SRC_URI is updated for the base recipe, but the copy of the SRC_URI in the override section doesn't account for this, leading to a build break: ``` | -- wechat_qrcode: Download: detect.caffemodel | CMake Error at /opt/work/upstream/fsl-xwayland/tmp/work/cortexa53-crypto-mx8mp-fsl-linux/opencv/4.5.2.imx-r0/git/cmake/OpenCVDownload.cmake:161 (message): | Not going to download detect.caffemodel ``` Additionally, the SRC_URI is long and complex, and copying it in our override section does make problems like this more likely. Fix the problem and simplify maintenance by replacing the SRC_URI copy with a targetted override. The override section now shows only the changes to SRC_URI. The fix includes these related changes: - a new patch file is added in the base recipe and is now copied locally - the override for SRCREV_contrib is redundant and is dropped Signed-off-by: Tom Hochstein --- .../opencv/0001-sfm-link-with-Glog_LIBS.patch | 44 ++++++++++++++++++++++ recipes-support/opencv/opencv_4.5.2.imx.bb | 40 +++++++++----------- 2 files changed, 62 insertions(+), 22 deletions(-) create mode 100644 recipes-support/opencv/opencv/0001-sfm-link-with-Glog_LIBS.patch (limited to 'recipes-support') diff --git a/recipes-support/opencv/opencv/0001-sfm-link-with-Glog_LIBS.patch b/recipes-support/opencv/opencv/0001-sfm-link-with-Glog_LIBS.patch new file mode 100644 index 00000000..7b2c4100 --- /dev/null +++ b/recipes-support/opencv/opencv/0001-sfm-link-with-Glog_LIBS.patch @@ -0,0 +1,44 @@ +From ffe20fc4ec46c6b491eff29a38f90686d4d035f6 Mon Sep 17 00:00:00 2001 +From: Martin Jansa +Date: Mon, 12 Apr 2021 20:37:40 +0000 +Subject: [PATCH] sfm: link with Glog_LIBS + +* in 4.5.0 there was explicit linkage with GLOG_LIBRARY, but since 4.5.1 with: + https://github.com/opencv/opencv_contrib/commit/23ee62a19b7a3e50d6dbf295359d8b1aff2e03fd + + it's gone, probably because Glog_FOUND is already set from Ceres, + but then GLOG_LIBRARIES is empty in LIBMV_LIGHT_LIBS and build with gold fails: + +FAILED: bin/example_tutorial_perspective_correction +: && TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/recipe-sysroot-native/usr/bin/x86_64-oe-linux/x86_64-oe-linux-g++ -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -ITOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/git/include -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0=/usr/src/debug/opencv/4.5.2-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0=/usr/src/debug/opencv/4.5.2-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/recipe-sysroot-native= -fvisibility-inlines-hidden -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -ITOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/git/include -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/recipe-sysroot -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -mssse3 -DNDEBUG -DNDEBUG -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -ITOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/git/include -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0=/usr/src/debug/opencv/4.5.2-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0=/usr/src/debug/opencv/4.5.2-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/recipe-sysroot-native= -fvisibility-inlines-hidden -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -ITOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/git/include -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/recipe-sysroot -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z,relro,-z,now -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z,relro,-z,now -Wl,--gc-sections -Wl,--as-needed samples/cpp/CMakeFiles/example_tutorial_perspective_correction.dir/tutorial_code/features2D/Homography/perspective_correction.cpp.o -o bin/example_tutorial_perspective_correction -ldl -lm -lpthread -lrt lib/libopencv_gapi.so.4.5.2 lib/libopencv_stitching.so.4.5.2 lib/libopencv_ts.so.4.5.2 lib/libopencv_alphamat.so.4.5.2 lib/libopencv_aruco.so.4.5.2 lib/libopencv_bgsegm.so.4.5.2 lib/libopencv_bioinspired.so.4.5.2 lib/libopencv_ccalib.so.4.5.2 lib/libopencv_dnn_objdetect.so.4.5.2 lib/libopencv_dnn_superres.so.4.5.2 lib/libopencv_dpm.so.4.5.2 lib/libopencv_face.so.4.5.2 lib/libopencv_fuzzy.so.4.5.2 lib/libopencv_hfs.so.4.5.2 lib/libopencv_img_hash.so.4.5.2 lib/libopencv_intensity_transform.so.4.5.2 lib/libopencv_line_descriptor.so.4.5.2 lib/libopencv_mcc.so.4.5.2 lib/libopencv_quality.so.4.5.2 lib/libopencv_rapid.so.4.5.2 lib/libopencv_reg.so.4.5.2 lib/libopencv_rgbd.so.4.5.2 lib/libopencv_saliency.so.4.5.2 lib/libopencv_sfm.so.4.5.2 lib/libopencv_stereo.so.4.5.2 lib/libopencv_structured_light.so.4.5.2 lib/libopencv_superres.so.4.5.2 lib/libopencv_surface_matching.so.4.5.2 lib/libopencv_tracking.so.4.5.2 lib/libopencv_videostab.so.4.5.2 lib/libopencv_wechat_qrcode.so.4.5.2 lib/libopencv_xfeatures2d.so.4.5.2 lib/libopencv_xobjdetect.so.4.5.2 lib/libopencv_xphoto.so.4.5.2 lib/libopencv_shape.so.4.5.2 lib/libopencv_highgui.so.4.5.2 lib/libopencv_datasets.so.4.5.2 lib/libopencv_ml.so.4.5.2 lib/libopencv_plot.so.4.5.2 lib/libopencv_phase_unwrapping.so.4.5.2 lib/libopencv_optflow.so.4.5.2 lib/libopencv_ximgproc.so.4.5.2 lib/libopencv_videoio.so.4.5.2 lib/libopencv_video.so.4.5.2 lib/libopencv_dnn.so.4.5.2 lib/libopencv_imgcodecs.so.4.5.2 lib/libopencv_objdetect.so.4.5.2 lib/libopencv_calib3d.so.4.5.2 lib/libopencv_features2d.so.4.5.2 lib/libopencv_flann.so.4.5.2 lib/libopencv_photo.so.4.5.2 lib/libopencv_imgproc.so.4.5.2 lib/libopencv_core.so.4.5.2 -Wl,-rpath-link,TOPDIR/tmp-glibc/work/core2-64-oe-linux/opencv/4.5.2-r0/build/lib && : +lib/libopencv_sfm.so.4.5.2: error: undefined reference to 'google::LogMessage::LogMessage(char const*, int)' +lib/libopencv_sfm.so.4.5.2: error: undefined reference to 'google::LogMessage::stream()' +lib/libopencv_sfm.so.4.5.2: error: undefined reference to 'google::LogMessage::~LogMessage()' +lib/libopencv_sfm.so.4.5.2: error: undefined reference to 'google::kLogSiteUninitialized' +lib/libopencv_sfm.so.4.5.2: error: undefined reference to 'fLI::FLAGS_v' +lib/libopencv_sfm.so.4.5.2: error: undefined reference to 'google::InitVLOG3__(int**, int*, char const*, int)' +lib/libopencv_sfm.so.4.5.2: error: undefined reference to 'google::LogMessageFatal::LogMessageFatal(char const*, int)' +lib/libopencv_sfm.so.4.5.2: error: undefined reference to 'google::LogMessageFatal::~LogMessageFatal()' +collect2: error: ld returned 1 exit status + + Add Glog_LIBS which is set to the same value as GLOG_LIBRARIES used to be. + +Upstream-Status: Submitted [https://github.com/opencv/opencv_contrib/pull/2923] + +Signed-off-by: Martin Jansa +--- + modules/sfm/CMakeLists.txt | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/modules/sfm/CMakeLists.txt b/modules/sfm/CMakeLists.txt +index 045a1fe6e..ee7cecdac 100644 +--- a/modules/sfm/CMakeLists.txt ++++ b/modules/sfm/CMakeLists.txt +@@ -84,6 +84,7 @@ set(LIBMV_LIGHT_LIBS + multiview + numeric + ${GLOG_LIBRARIES} ++ ${Glog_LIBS} + ${GFLAGS_LIBRARIES} + ) + diff --git a/recipes-support/opencv/opencv_4.5.2.imx.bb b/recipes-support/opencv/opencv_4.5.2.imx.bb index 0566341a..2d71acfc 100644 --- a/recipes-support/opencv/opencv_4.5.2.imx.bb +++ b/recipes-support/opencv/opencv_4.5.2.imx.bb @@ -241,32 +241,28 @@ SUMMARY = "Opencv : The Open Computer Vision Library, i.MX Fork" LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" +# Replace the opencv URL with the fork SRCREV_opencv = "5423d53ae0d116ee5bbe52f8b5503f0cd8586998" -SRCREV_contrib = "f5d7f6712d4ff229ba4f45cf79dfd11c557d56fd" +OPENCV_SRC ?= "git://source.codeaurora.org/external/imx/opencv-imx.git;protocol=https" +SRCBRANCH = "4.5.2_imx" +SRC_URI_remove = "git://github.com/opencv/opencv.git;name=opencv" +SRC_URI =+ "${OPENCV_SRC};branch=${SRCBRANCH};name=opencv" + +# Add opencv_extra SRCREV_extra = "855c4528402e563283f86f28c6393f57eb5dcf62" -SRC_URI[tinydnn.md5sum] = "adb1c512e09ca2c7a6faef36f9c53e59" -SRC_URI[tinydnn.sha256sum] = "e2c61ce8c5debaa644121179e9dbdcf83f497f39de853f8dd5175846505aa18b" +SRC_URI += " \ + git://github.com/opencv/opencv_extra.git;destsuffix=extra;name=extra \ + file://0001-Add-smaller-version-of-download_models.py.patch;patchdir=../extra \ +" SRCREV_FORMAT_append = "_extra" -OPENCV_SRC ?= "git://source.codeaurora.org/external/imx/opencv-imx.git;protocol=https" -SRCBRANCH = "4.5.2_imx" -SRC_URI = "${OPENCV_SRC};branch=${SRCBRANCH};name=opencv \ - git://github.com/opencv/opencv_extra.git;destsuffix=extra;name=extra \ - git://github.com/opencv/opencv_contrib.git;destsuffix=contrib;name=contrib \ - git://github.com/opencv/opencv_3rdparty.git;branch=ippicv/master_20191018;destsuffix=ipp;name=ipp \ - git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_boostdesc_20161012;destsuffix=boostdesc;name=boostdesc \ - git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_vgg_20160317;destsuffix=vgg;name=vgg \ - git://github.com/opencv/opencv_3rdparty.git;branch=contrib_face_alignment_20170818;destsuffix=face;name=face \ - https://github.com/tiny-dnn/tiny-dnn/archive/v1.0.0a3.tar.gz;destsuffix=git/3rdparty/tinydnn/tiny-dnn-1.0.0a3;name=tinydnn;unpack=false \ - file://0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch \ - file://0003-To-fix-errors-as-following.patch \ - file://0001-Temporarliy-work-around-deprecated-ffmpeg-RAW-functi.patch \ - file://0001-Dont-use-isystem.patch \ - file://download.patch \ - file://0001-Make-ts-module-external.patch \ - file://OpenCV_DNN_examples.patch \ - file://0001-Add-smaller-version-of-download_models.py.patch;patchdir=../extra \ - " +# Add tiny-dnn +SRC_URI[tinydnn.md5sum] = "adb1c512e09ca2c7a6faef36f9c53e59" +SRC_URI[tinydnn.sha256sum] = "e2c61ce8c5debaa644121179e9dbdcf83f497f39de853f8dd5175846505aa18b" +SRC_URI += " \ + https://github.com/tiny-dnn/tiny-dnn/archive/v1.0.0a3.tar.gz;destsuffix=git/3rdparty/tinydnn/tiny-dnn-1.0.0a3;name=tinydnn;unpack=false \ + file://OpenCV_DNN_examples.patch \ +" PACKAGECONFIG_remove = "eigen" PACKAGECONFIG_append_mx8 = " dnn text" -- cgit v1.2.3-54-g00ecf