package/opencv3: add patch to fix CMake 4 build issue
PATCH 1/3 package/opencv3: add patch to fix CMake 4 build issue
Add a small patch to fix CMake 4 build issues. Unfortunately, while cmake/OpenCVMinDepVersions.cmake provides a MIN_VER_CMAKE that we could pass on the command line, cmake/OpenCVGenPkgconfig.cmake doesn't use it, so we anyway have to patch the package.
Since opencv3 is basically unmaintained, there is no point sending this patch upstream.
Fixes:
https://autobuild.buildroot.net/results/cc857993920607958dd817c6a877ed9386c05738/
--- ...inimum-required-CMake-version-to-3.5.patch | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 package/opencv3/0001-cmake-set-minimum-required-CMake-version-to-3.5.patch
package/opencv3/0001-cmake-set-minimum-required-CMake-version-to-3.5.patch new file +41 -0
@@ -0,0 +1,41 @@ +From 3b7311f48ef70127ddad7c7ea9c008fa6af3a9a1 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni <[email protected]> +Date: Thu, 25 Dec 2025 23:11:27 +0100 +Subject: [PATCH] cmake: set minimum required CMake version to 3.5 + +This fixes build with CMake 4. + +Upstream: N/A, opencv 3.x is no longer maintained +Signed-off-by: Thomas Petazzoni <[email protected]> +--- + cmake/OpenCVGenPkgconfig.cmake | 2 +- + cmake/OpenCVMinDepVersions.cmake | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/cmake/OpenCVGenPkgconfig.cmake b/cmake/OpenCVGenPkgconfig.cmake +index 425c0faa3b..9642a4b983 100644 +--- a/cmake/OpenCVGenPkgconfig.cmake ++++ b/cmake/OpenCVGenPkgconfig.cmake +@@ -110,7 +110,7 @@ endif() + # ============================================================================= + else() # DEFINED CMAKE_HELPER_SCRIPT + +-cmake_minimum_required(VERSION 2.8.12.2) ++cmake_minimum_required(VERSION 3.5) + cmake_policy(SET CMP0012 NEW) + include("${CMAKE_HELPER_SCRIPT}") + include("${OpenCV_SOURCE_DIR}/cmake/OpenCVUtils.cmake") +diff --git a/cmake/OpenCVMinDepVersions.cmake b/cmake/OpenCVMinDepVersions.cmake +index e67856bb97..eb7a6d861e 100644 +--- a/cmake/OpenCVMinDepVersions.cmake ++++ b/cmake/OpenCVMinDepVersions.cmake +@@ -1,5 +1,5 @@ + if(NOT DEFINED MIN_VER_CMAKE) +- set(MIN_VER_CMAKE 2.8.12.2) ++ set(MIN_VER_CMAKE 3.5) + endif() + set(MIN_VER_CUDA 6.5) + set(MIN_VER_PYTHON2 2.7) +-- +2.52.0 +
Signature · 6 lines
2.52.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/3 package/opencv3: drop support for protobuf
The protobuf support breaks the build, as protobuf includes libabseil-cpp headers, which now require C++14. opencv3 doesn't have any ENABLE_CXX14 option, so for the time being, disable protobuf support until someone bothers enough to fix this up.
While we suspect a libabseil-cpp version bump to be responsible for the issue, we are not 100% sure. However, the issue is definitely present in Buildroot 2025.02.x, as it can be reproduced using the following defconfig:
BR2_aarch64=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
BR2_PACKAGE_OPENCV3=y
BR2_PACKAGE_OPENCV3_LIB_SHAPE=y
BR2_PACKAGE_OPENCV3_LIB_STITCHING=y
BR2_PACKAGE_OPENCV3_LIB_SUPERRES=y
BR2_PACKAGE_OPENCV3_LIB_TS=y
BR2_PACKAGE_OPENCV3_LIB_VIDEOSTAB=y
BR2_PACKAGE_OPENCV3_WITH_PROTOBUF=y
Fixes:
https://autobuild.buildroot.net/results/39432e7746e6bc5224592a7d2f744ca992bd529a/
--- Config.in.legacy | 7 +++++++ package/opencv3/Config.in | 12 ------------ package/opencv3/opencv3.mk | 12 +----------- 3 files changed, 8 insertions(+), 23 deletions(-)
Config.in.legacy +7 -0
@@ -146,6 +146,13 @@ endif comment "Legacy options removed in 2026.02" +config BR2_PACKAGE_OPENCV3_WITH_PROTOBUF + bool "opencv3 protobuf support removed" + select BR2_LEGACY + help + Support for OpenCV 3 protobuf support has been removed as it + was no longer compatible with recent versions of protobuf. + config BR2_PACKAGE_LIBDNET_PYTHON bool "libdnet python module removed" select BR2_LEGACY
package/opencv3/Config.in +0 -12
@@ -278,18 +278,6 @@ config BR2_PACKAGE_OPENCV3_WITH_PNG help Use shared libpng from the target system. -config BR2_PACKAGE_OPENCV3_WITH_PROTOBUF - bool "protobuf support" - depends on BR2_PACKAGE_PROTOBUF_ARCH_SUPPORTS # protobuf - depends on BR2_TOOLCHAIN_GCC_AT_LEAST_8 # protobuf - select BR2_PACKAGE_PROTOBUF - help - Use shared protobuf from the target system. - -comment "protobuf support needs a toolchain w/ gcc >= 8" - depends on BR2_PACKAGE_PROTOBUF_ARCH_SUPPORTS - depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_8 - config BR2_PACKAGE_OPENCV3_WITH_TIFF bool "tiff support" select BR2_PACKAGE_TIFF
package/opencv3/opencv3.mk +1 -11
@@ -223,6 +223,7 @@ OPENCV3_CONF_OPTS += \ -DWITH_OPENEXR=OFF \ -DWITH_OPENNI2=OFF \ -DWITH_OPENNI=OFF \ + -DWITH_PROTOBUF=OFF \ -DWITH_UNICAP=OFF \ -DWITH_VA=OFF \ -DWITH_VA_INTEL=OFF \
@@ -282,17 +283,6 @@ else OPENCV3_CONF_OPTS += -DWITH_PNG=OFF endif -ifeq ($(BR2_PACKAGE_OPENCV3_WITH_PROTOBUF),y) -# protobuf needs c++11 (since 3.6.0) -OPENCV3_CONF_OPTS += \ - -DENABLE_CXX11=ON \ - -DPROTOBUF_UPDATE_FILES=ON \ - -DWITH_PROTOBUF=ON -OPENCV3_DEPENDENCIES += protobuf -else -OPENCV3_CONF_OPTS += -DWITH_PROTOBUF=OFF -endif - ifeq ($(BR2_PACKAGE_OPENCV3_WITH_QT5),y) OPENCV3_CONF_OPTS += -DWITH_QT=5 OPENCV3_DEPENDENCIES += qt5base
Signature · 6 lines
2.52.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 2/3] package/opencv3: drop support for protobuf
In reply of:
Quoted 21 lines
The protobuf support breaks the build, as protobuf includes libabseil-cpp headers, which now require C++14. opencv3 doesn't have any
ENABLE_CXX14option, so for the time being, disable protobuf support until someone bothers enough to fix this up.While we suspect a libabseil-cpp version bump to be responsible for the issue, we are not 100% sure. However, the issue is definitely present in Buildroot 2025.02.x, as it can be reproduced using the following defconfig:
BR2_aarch64=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
BR2_PACKAGE_OPENCV3=y
BR2_PACKAGE_OPENCV3_LIB_SHAPE=y
BR2_PACKAGE_OPENCV3_LIB_STITCHING=y
BR2_PACKAGE_OPENCV3_LIB_SUPERRES=y
BR2_PACKAGE_OPENCV3_LIB_TS=y
BR2_PACKAGE_OPENCV3_LIB_VIDEOSTAB=y
BR2_PACKAGE_OPENCV3_WITH_PROTOBUF=y
Quoted 5 lines
Fixes:
https://autobuild.buildroot.net/results/39432e7746e6bc5224592a7d2f744ca992bd529a/
Signed-off-by Thomas Petazzoni <[email protected]>
Applied to 2025.02.x and 2025.11.x. Thanks
Quoted 84 lines
--- Config.in.legacy | 7 +++++++ package/opencv3/Config.in | 12 ------------ package/opencv3/opencv3.mk | 12 +----------- 3 files changed, 8 insertions(+), 23 deletions(-)Config.in.legacy +7
-0@@ -146,6 +146,13 @@ endif comment "Legacy options removed in 2026.02" +config BR2_PACKAGE_OPENCV3_WITH_PROTOBUF + bool "opencv3 protobuf support removed" + select BR2_LEGACY + help + Support for OpenCV 3 protobuf support has been removed as it + was no longer compatible with recent versions of protobuf. + config BR2_PACKAGE_LIBDNET_PYTHON bool "libdnet python module removed" select BR2_LEGACYpackage/opencv3/Config.in +0
-12@@ -278,18 +278,6 @@ config BR2_PACKAGE_OPENCV3_WITH_PNG help Use shared libpng from the target system. -config BR2_PACKAGE_OPENCV3_WITH_PROTOBUF - bool "protobuf support" - depends on BR2_PACKAGE_PROTOBUF_ARCH_SUPPORTS # protobuf - depends on BR2_TOOLCHAIN_GCC_AT_LEAST_8 # protobuf - select BR2_PACKAGE_PROTOBUF - help - Use shared protobuf from the target system. - -comment "protobuf support needs a toolchain w/ gcc >= 8" - depends on BR2_PACKAGE_PROTOBUF_ARCH_SUPPORTS - depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_8 - config BR2_PACKAGE_OPENCV3_WITH_TIFF bool "tiff support" select BR2_PACKAGE_TIFFpackage/opencv3/opencv3.mk +1
-11@@ -223,6 +223,7 @@ OPENCV3_CONF_OPTS += \ -DWITH_OPENEXR=OFF \ -DWITH_OPENNI2=OFF \ -DWITH_OPENNI=OFF \ + -DWITH_PROTOBUF=OFF \ -DWITH_UNICAP=OFF \ -DWITH_VA=OFF \ -DWITH_VA_INTEL=OFF \@@ -282,17 +283,6 @@ else OPENCV3_CONF_OPTS += -DWITH_PNG=OFF endif -ifeq ($(BR2_PACKAGE_OPENCV3_WITH_PROTOBUF),y) -# protobuf needs c++11 (since 3.6.0) -OPENCV3_CONF_OPTS += \ - -DENABLE_CXX11=ON \ - -DPROTOBUF_UPDATE_FILES=ON \ - -DWITH_PROTOBUF=ON -OPENCV3_DEPENDENCIES += protobuf -else -OPENCV3_CONF_OPTS += -DWITH_PROTOBUF=OFF -endif - ifeq ($(BR2_PACKAGE_OPENCV3_WITH_QT5),y) OPENCV3_CONF_OPTS += -DWITH_QT=5 OPENCV3_DEPENDENCIES += qt5baseSignature · 6 lines
2.52.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 3/3 package/opencv3: drop support for ffmpeg
In reply to Thomas Petazzoni via buildrootopencv3's code is not compatible with newer versions of ffmpeg, and opencv3 is no longer maintained, so we have no choice but to disable its ffmpeg support.
Fixes:
https://autobuild.buildroot.net/results/9ae3911583cccb6362f33cd82e5eaafb059fdc76/
It's not clear which ffmpeg version bump broken the build exactly, but this issue is definitely present in 2025.02.x as the following defconfig fails to build in a similar way on 2025.02.x:
BR2_aarch64=y
BR2_TOOLCHAIN_EXTERNAL=y BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_AARCH64_GLIBC_STABLE=y BR2_PACKAGE_FFMPEG_NONFREE=y
# BR2_PACKAGE_FFMPEG_FFMPEG is not set
# BR2_PACKAGE_FFMPEG_INDEVS is not set
# BR2_PACKAGE_FFMPEG_OUTDEVS is not set BR2_PACKAGE_OPENCV3=y BR2_PACKAGE_OPENCV3_LIB_VIDEOIO=y BR2_PACKAGE_OPENCV3_BUILD_PERF_TESTS=y BR2_PACKAGE_OPENCV3_WITH_FFMPEG=y BR2_PACKAGE_OPENCV3_INSTALL_DATA=y
--- Config.in.legacy | 7 +++++++ package/ffmpeg/ffmpeg.mk | 6 +++--- package/opencv3/Config.in | 9 --------- package/opencv3/opencv3.mk | 8 +------- 4 files changed, 11 insertions(+), 19 deletions(-)
Config.in.legacy +7 -0
@@ -146,6 +146,13 @@ endif comment "Legacy options removed in 2026.02" +config BR2_PACKAGE_OPENCV3_WITH_FFMPEG + bool "opencv3 ffmpeg support removed" + select BR2_LEGACY + help + Support for OpenCV 3 ffmpeg support has been removed as it + was no longer compatible with recent versions of ffmpeg. + config BR2_PACKAGE_OPENCV3_WITH_PROTOBUF bool "opencv3 protobuf support removed" select BR2_LEGACY
package/ffmpeg/ffmpeg.mk +3 -3
@@ -287,11 +287,11 @@ else FFMPEG_CONF_OPTS += --disable-vdpau endif -# To avoid a circular dependency only use opencv if opencv itself does -# not depend on ffmpeg. -ifeq ($(BR2_PACKAGE_OPENCV3_LIB_IMGPROC)x$(BR2_PACKAGE_OPENCV3_WITH_FFMPEG),yx) +ifeq ($(BR2_PACKAGE_OPENCV3_LIB_IMGPROC),y) FFMPEG_CONF_OPTS += --enable-libopencv FFMPEG_DEPENDENCIES += opencv3 +# To avoid a circular dependency only use opencv if opencv itself does +# not depend on ffmpeg. else ifeq ($(BR2_PACKAGE_OPENCV4_LIB_IMGPROC)x$(BR2_PACKAGE_OPENCV4_WITH_FFMPEG),yx) FFMPEG_CONF_OPTS += --enable-libopencv \ --extra-cflags=-I$(STAGING_DIR)/usr/include/opencv4
package/opencv3/Config.in +0 -9
@@ -232,15 +232,6 @@ config BR2_PACKAGE_OPENCV3_BUILD_PERF_TESTS comment "3rd party support" -config BR2_PACKAGE_OPENCV3_WITH_FFMPEG - bool "ffmpeg support" - depends on BR2_PACKAGE_FFMPEG_ARCH_SUPPORTS - select BR2_PACKAGE_BZIP2 - select BR2_PACKAGE_FFMPEG - select BR2_PACKAGE_FFMPEG_SWSCALE - help - Use ffmpeg from the target system. - config BR2_PACKAGE_OPENCV3_WITH_GSTREAMER1 bool "gstreamer-1.x" depends on BR2_USE_MMU # gstreamer1 -> libglib2
package/opencv3/opencv3.mk +1 -7
@@ -212,6 +212,7 @@ OPENCV3_CONF_OPTS += \ -DWITH_1394=OFF \ -DWITH_CLP=OFF \ -DWITH_EIGEN=OFF \ + -DWITH_FFMPEG=OFF \ -DWITH_GDAL=OFF \ -DWITH_GPHOTO2=OFF \ -DWITH_GSTREAMER_0_10=OFF \
@@ -232,13 +233,6 @@ OPENCV3_CONF_OPTS += \ OPENCV3_DEPENDENCIES += host-pkgconf zlib -ifeq ($(BR2_PACKAGE_OPENCV3_WITH_FFMPEG),y) -OPENCV3_CONF_OPTS += -DWITH_FFMPEG=ON -OPENCV3_DEPENDENCIES += ffmpeg bzip2 -else -OPENCV3_CONF_OPTS += -DWITH_FFMPEG=OFF -endif - ifeq ($(BR2_PACKAGE_OPENCV3_WITH_GSTREAMER1),y) OPENCV3_CONF_OPTS += -DWITH_GSTREAMER=ON OPENCV3_DEPENDENCIES += gstreamer1 gst1-plugins-base
Signature · 6 lines
2.52.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 3/3] package/opencv3: drop support for ffmpeg
In reply of:
Quoted 26 lines
opencv3's code is not compatible with newer versions of ffmpeg, and opencv3 is no longer maintained, so we have no choice but to disable its ffmpeg support.
Fixes:
https://autobuild.buildroot.net/results/9ae3911583cccb6362f33cd82e5eaafb059fdc76/
It's not clear which ffmpeg version bump broken the build exactly, but this issue is definitely present in 2025.02.x as the following defconfig fails to build in a similar way on 2025.02.x:
BR2_aarch64=y
BR2_TOOLCHAIN_EXTERNAL=y BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_AARCH64_GLIBC_STABLE=y BR2_PACKAGE_FFMPEG_NONFREE=y
#BR2_PACKAGE_FFMPEG_FFMPEGis not set
#BR2_PACKAGE_FFMPEG_INDEVSis not set
#BR2_PACKAGE_FFMPEG_OUTDEVSis not set BR2_PACKAGE_OPENCV3=y BR2_PACKAGE_OPENCV3_LIB_VIDEOIO=y BR2_PACKAGE_OPENCV3_BUILD_PERF_TESTS=y BR2_PACKAGE_OPENCV3_WITH_FFMPEG=y BR2_PACKAGE_OPENCV3_INSTALL_DATA=y
Quoted 1 line
Signed-off-by Thomas Petazzoni <[email protected]>
Applied to 2025.02.x and 2025.11.x. Thanks
Quoted 97 lines
--- Config.in.legacy | 7 +++++++ package/ffmpeg/ffmpeg.mk | 6 +++--- package/opencv3/Config.in | 9 --------- package/opencv3/opencv3.mk | 8 +------- 4 files changed, 11 insertions(+), 19 deletions(-)Config.in.legacy +7
-0@@ -146,6 +146,13 @@ endif comment "Legacy options removed in 2026.02" +config BR2_PACKAGE_OPENCV3_WITH_FFMPEG + bool "opencv3 ffmpeg support removed" + select BR2_LEGACY + help + Support for OpenCV 3 ffmpeg support has been removed as it + was no longer compatible with recent versions of ffmpeg. + config BR2_PACKAGE_OPENCV3_WITH_PROTOBUF bool "opencv3 protobuf support removed" select BR2_LEGACYpackage/ffmpeg/ffmpeg.mk +3
-3@@ -287,11 +287,11 @@ else FFMPEG_CONF_OPTS += --disable-vdpau endif -# To avoid a circular dependency only use opencv if opencv itself does -# not depend on ffmpeg. -ifeq ($(BR2_PACKAGE_OPENCV3_LIB_IMGPROC)x$(BR2_PACKAGE_OPENCV3_WITH_FFMPEG),yx) +ifeq ($(BR2_PACKAGE_OPENCV3_LIB_IMGPROC),y) FFMPEG_CONF_OPTS += --enable-libopencv FFMPEG_DEPENDENCIES += opencv3 +# To avoid a circular dependency only use opencv if opencv itself does +# not depend on ffmpeg. else ifeq ($(BR2_PACKAGE_OPENCV4_LIB_IMGPROC)x$(BR2_PACKAGE_OPENCV4_WITH_FFMPEG),yx) FFMPEG_CONF_OPTS += --enable-libopencv \ --extra-cflags=-I$(STAGING_DIR)/usr/include/opencv4package/opencv3/Config.in +0
-9@@ -232,15 +232,6 @@ config BR2_PACKAGE_OPENCV3_BUILD_PERF_TESTS comment "3rd party support" -config BR2_PACKAGE_OPENCV3_WITH_FFMPEG - bool "ffmpeg support" - depends on BR2_PACKAGE_FFMPEG_ARCH_SUPPORTS - select BR2_PACKAGE_BZIP2 - select BR2_PACKAGE_FFMPEG - select BR2_PACKAGE_FFMPEG_SWSCALE - help - Use ffmpeg from the target system. - config BR2_PACKAGE_OPENCV3_WITH_GSTREAMER1 bool "gstreamer-1.x" depends on BR2_USE_MMU # gstreamer1 -> libglib2package/opencv3/opencv3.mk +1
-7@@ -212,6 +212,7 @@ OPENCV3_CONF_OPTS += \ -DWITH_1394=OFF \ -DWITH_CLP=OFF \ -DWITH_EIGEN=OFF \ + -DWITH_FFMPEG=OFF \ -DWITH_GDAL=OFF \ -DWITH_GPHOTO2=OFF \ -DWITH_GSTREAMER_0_10=OFF \@@ -232,13 +233,6 @@ OPENCV3_CONF_OPTS += \ OPENCV3_DEPENDENCIES += host-pkgconf zlib -ifeq ($(BR2_PACKAGE_OPENCV3_WITH_FFMPEG),y) -OPENCV3_CONF_OPTS += -DWITH_FFMPEG=ON -OPENCV3_DEPENDENCIES += ffmpeg bzip2 -else -OPENCV3_CONF_OPTS += -DWITH_FFMPEG=OFF -endif - ifeq ($(BR2_PACKAGE_OPENCV3_WITH_GSTREAMER1),y) OPENCV3_CONF_OPTS += -DWITH_GSTREAMER=ON OPENCV3_DEPENDENCIES += gstreamer1 gst1-plugins-baseSignature · 6 lines
2.52.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 8 lines · Thomas Petazzoni via buildroot
Add a small patch to fix CMake 4 build issues. Unfortunately, while cmake/OpenCVMinDepVersions.cmake provides a
MIN_VER_CMAKEthat we could pass on the command line, cmake/OpenCVGenPkgconfig.cmake doesn't use it, so we anyway have to patch the package.Since opencv3 is basically unmaintained, there is no point sending this patch upstream.
Quoted 6 lines
Fixes:
https://autobuild.buildroot.net/results/cc857993920607958dd817c6a877ed9386c05738/
Signed-off-by Thomas Petazzoni <[email protected]>
Series applied to master, thanks.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot