Repository navigation
build: fail early when OpenCV is older than dartcv requires - #451
Merged
Merged
Conversation
A build pointed at an existing OpenCV through OpenCV_DIR accepts whatever version it finds. dartcv calls APIs introduced in 4.12 — Mat::reinterpret, cv::thresholdWithMask, cv::getClosestEllipsePoints, fisheye::solvePnPRansac and replaceWriteLogMessage — so an older one configures cleanly and then fails deep into the build with errors that never mention the version. Measured by building dartcv against each release: 4.8.1 31 errors 4.10.0 11 errors 4.11.0 8 errors 4.12.0 builds The configure step now stops with the version and the path it found, instead of leaving the reader to infer it from a missing 'cv::hfloat'.
The floor applies however OpenCV arrives. Building an older release from source configures and compiles OpenCV happily, and only fails once dartcv itself is compiled against it, which is the same late and unexplained failure the previous commit removed for the bring-your-own path.
Owner
|
Thanks for the suggestions. I never anticipated that users would use their own compiled OpenCV, but this defensive strategy sounds okay. will merge it without changes. Thanks again~ |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #451 +/- ##
=======================================
Coverage 92.24% 92.24%
=======================================
Files 60 60
Lines 11869 11869
=======================================
Hits 10948 10948
Misses 921 921
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
DARTCV_DISABLE_DOWNLOAD_OPENCVis set and the build is pointed at an existing OpenCV throughOpenCV_DIR,find_package(OpenCV REQUIRED)accepts whatever version it finds. dartcv calls a handful of APIs added in 4.12, so an older OpenCV configures cleanly and then fails well into the build, with errors that never mention the version as the cause.This adds a version check right after
find_package, so the configure step stops with a message that names the version and the path.How the minimum was determined
I built dartcv against several OpenCV releases, each compiled from source with
core,imgproc,imgcodecs,calib3d,features2d,flann,ximgprocand contrib:The APIs that set the floor:
cv::Mat::reinterpretcv::thresholdWithMaskcv::getClosestEllipsePointscv::fisheye::solvePnPRansaccv::utils::logging::internal::replaceWriteLogMessage,...Excv::approxPolyNcv::hfloatcv::AKAZE::getMaxPoints/setMaxPointsSo
4.12is the constant here. The download and build-from-source paths already satisfy it —DARTCV_OPENCV_VERSIONdefaults to4.12.0.0— so nothing changes for them; this only affects builds that supply their own OpenCV.Before and after
Building against OpenCV 4.11.0 previously produced 8 errors like:
and against 4.8.1, 31 of them, starting with a missing
cv::hfloatincore/lut.hpp. Neither points at the real problem.Now:
Verification
libdartcv.dylib(12 MB) withximgprocandcalib3dlinked in.Tested on macOS arm64 with each OpenCV built from source. Happy to phrase the message differently, or to move the check into
CMakeLists.txtif you would rather keepdownload_setup_opencv.cmaketo download logic only.