Skip to content

build: add opencv5 to the list of pkgconfig names#719

Merged
twistedfall merged 1 commit into
twistedfall:masterfrom
de-vri-es:pkgconfig-opencv5
Jul 16, 2026
Merged

build: add opencv5 to the list of pkgconfig names#719
twistedfall merged 1 commit into
twistedfall:masterfrom
de-vri-es:pkgconfig-opencv5

Conversation

@de-vri-es

Copy link
Copy Markdown
Contributor

On Arch Linux, the pkgconfig file for opencv5 is called "opencv5.pc". This seems like a vanilla upstream filename.

See https://archlinux.org/packages/extra/x86_64/opencv/ for the package details.

@twistedfall

Copy link
Copy Markdown
Owner

Thanks a lot!

@twistedfall
twistedfall merged commit 2721645 into twistedfall:master Jul 16, 2026
@AlexanderStein

Copy link
Copy Markdown

Unfortunately with this, a opencv5 installation hides a parallel opencv4 installation breaking at compile time:

error[E0433]: cannot find `features` in `crate`
    --> /tmp/test/target/debug/build/opencv-7f20f0ffea32c899/out/opencv/objdetect.rs:1221:166
     |
1221 |     pub fn find_circles_grid(image: &impl ToInputArray, pattern_size: core::Size, centers: &mut impl ToOutputArray, flags: i32, blob_detector: Option<&core::Ptr<crate::features::Feature2D>>) -> Result<bool> {
     |                                                                                                                                                                         ^^^^^^^^ could not find `features` in the crate root

error[E0433]: cannot find `features` in `crate`
    --> /tmp/test/target/debug/build/opencv-7f20f0ffea32c899/out/opencv/objdetect.rs:1270:178
     |
1270 | ...enters: &mut impl ToOutputArray, flags: i32, blob_detector: Option<&core::Ptr<crate::features::Feature2D>>, parameters: crate::objdetect::CirclesGridFinderParameters) -> Result<bool> {
     |                                                                                         ^^^^^^^^ could not find `features` in the crate root

error[E0433]: cannot find `dnn` in `crate`
    --> /tmp/test/target/debug/build/opencv-7f20f0ffea32c899/out/opencv/objdetect.rs:6123:37
     |
6123 |         pub fn create_1(net: &impl crate::dnn::NetTraitConst) -> Result<core::Ptr<crate::objdetect::CCheckerDetector>> {
     |

In other words I have both opencv5 and opencv4 (via AUR) installed, but my project requires opencv4, but opencv5 is selected

@de-vri-es

de-vri-es commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

You can still set OPENCV_PACKAGE_NAME to force opencv4 to be selected. It seems sensible to me that 5 is selected by default in this scenario.

@AlexanderStein

Copy link
Copy Markdown

You can still set OPENCV_PACKAGE_NAME to force opencv4 to be selected. It seems sensible to me that 5 is selected by default in this scenario.

Ah nice. Thanks. There is also OPENCV_PKGCONFIG_NAME which seems more appropriate in my case. But this does the trick. So yeah opencv5 can be the default if it is overwritable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants