Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 951724 - media-libs/opencv: [clang-4] failure to build due to needing cmake mid-build
Summary: media-libs/opencv: [clang-4] failure to build due to needing cmake mid-build
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Paul Zander
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks: cmake-4
  Show dependency tree
 
Reported: 2025-03-21 18:49 UTC by NHO
Modified: 2025-04-14 18:01 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
compressed build log (opencv.build.log.zst,43.62 KB, application/zstd)
2025-03-21 18:51 UTC, NHO
Details
CMake-4.x patch (cmake-4.0.0-version.patch,496 bytes, patch)
2025-04-11 18:04 UTC, Vladislav Mikhailikov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description NHO 2025-03-21 18:49:05 UTC
https://github.com/opencv/opencv/blob/85669309222191ccf9ed8767ec9f14f0e790eee4/cmake/OpenCVGenPkgconfig.cmake#L113
[1157/1198] cd /var/tmp/portage/media-libs/opencv-4.10.0/work/opencv-4.10.0_build-abi_x86_64.amd64 && /usr/bin/cmake -DCMAKE_HELPER_SCRIPT=/var/tmp/portage/media-libs/opencv-4.10.0/work/opencv-4.10.0_build-abi_x86_64.amd64/OpenCVGenPkgConfig.info.cmake -P /var/tmp/portage/media-libs/opencv-4.10.0/work/opencv-4.10.0/cmake/OpenCVGenPkgconfig.cmake
FAILED: unix-install/opencv4.pc /var/tmp/portage/media-libs/opencv-4.10.0/work/opencv-4.10.0_build-abi_x86_64.amd64/unix-install/opencv4.pc 
cd /var/tmp/portage/media-libs/opencv-4.10.0/work/opencv-4.10.0_build-abi_x86_64.amd64 && /usr/bin/cmake -DCMAKE_HELPER_SCRIPT=/var/tmp/portage/media-libs/opencv-4.10.0/work/opencv-4.10.0_build-abi_x86_64.amd64/OpenCVGenPkgConfig.info.cmake -P /var/tmp/portage/media-libs/opencv-4.10.0/work/opencv-4.10.0/cmake/OpenCVGenPkgconfig.cmake
CMake Error at /var/tmp/portage/media-libs/opencv-4.10.0/work/opencv-4.10.0/cmake/OpenCVGenPkgconfig.cmake:113 (cmake_minimum_required):
  Compatibility with CMake < 3.5 has been removed from CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.

  Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.


Reproducible: Always
Comment 1 NHO 2025-03-21 18:51:14 UTC
Created attachment 921589 [details]
compressed build log
Comment 2 NHO 2025-03-21 18:53:35 UTC
Reported upstream at https://github.com/opencv/opencv/issues/27122
Comment 3 NHO 2025-03-21 19:08:14 UTC
Failure is with
USE="contrib contribdnn eigen features2d ffmpeg jpeg opengl openmp png qt6 tiff truetype vaapi webp -atlas -avif -contribcvv -contribfreetype -contribhdf (-contribovis) -contribsfm -contribxfeatures2d -cuda -cudnn -debug -dnnsamples -doc -examples -gdal -gflags -glog -gphoto2 -gstreamer -gtk3 -ieee1394 -jasper -java -jpeg2k -lapack -mkl -non-free -opencl -opencvapps -openexr -python -quirc -tbb -tesseract -test -testprograms -v4l -vtk -xine"
Looking at the code, I suspect there will be more failures, but they don't manifest with this configuration.
Comment 4 Vladislav Mikhailikov 2025-04-11 18:04:06 UTC
Created attachment 924407 [details, diff]
CMake-4.x patch

Tnis patch solves the issue with CMake 4.x.x. Checked with CMake-4.0.1. For quick fix  create folder /etc/portage/patches/media-libs/opencv and put it there.
Comment 5 Larry the Git Cow gentoo-dev 2025-04-14 18:01:12 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de005c58db7f4b0cfff3f5c0df46e69b8eec3ac1

commit de005c58db7f4b0cfff3f5c0df46e69b8eec3ac1
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2025-04-13 19:25:57 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2025-04-14 18:00:33 +0000

    media-libs/opencv: Fix build w/ >=cmake-4
    
    Closes: https://bugs.gentoo.org/951724
    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>

 media-libs/opencv/files/opencv-4.10.0-cmake4.patch | 165 +++++++++++++++++++++
 media-libs/opencv/opencv-4.10.0.ebuild             |   1 +
 2 files changed, 166 insertions(+)