Skip to content

Compilation error with Opencv version 5 #718

Description

@JRazek

Hi, I'm having trouble compiling the project after the update of opencv. I import opencv with:

opencv = { version = "0.99.0", features = ["clang-runtime", "calib3d", "imgproc", "video", "videoio", "highgui", "dnn", "tracking", "rgb", "imgcodecs"], default-features = false }

rustc version:

rustc 1.98.0-nightly (654079540 2026-06-12)

opencv version:

local/opencv-cuda 5.0.0-6

I use arch.

error message:

error[E0425]: cannot find type `Feature2D` in module `crate::features2d`
12881 |     ptr_extern! { crate::features2d::Feature2D,
      |                                      ^^^^^^^^^ not found in `crate::features2d`
error[E0405]: cannot find trait `Feature2DTraitConst` in module `crate::features2d`

and so on, only Feature2D seems to be affected.

cargo log:

     Running `CARGO=/home/username/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo CARGO_CRATE_NAME=opencv CARGO_MANIFEST_DIR=/home/username/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/opencv-0.99.0 CARGO_MANIFEST_PATH=/home/username/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/opencv-0.99.0/Carg
o.toml CARGO_PKG_AUTHORS='Pro <twisted.fall@gmail.com>:Mathieu Poumeyrol <kali@zoy.org>' CARGO_PKG_DESCRIPTION='Rust bindings for OpenCV' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE=MIT CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=opencv CARGO_PKG_README=README.md CARGO_PKG_REPOSITORY='https://github.com/twistedfall/opencv
-rust' CARGO_PKG_RUST_VERSION=1.88.0 CARGO_PKG_VERSION=0.99.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=99 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/home/username/rust_projects/project/target/release/deps:/home/username/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib' OUT_DIR=/h
ome/username/rust_projects/project/target/release/build/opencv-5306aa0cc9669f95/out /home/username/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name opencv --edition=2024 /home/username/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/opencv-0.99.0/src/lib.rs --error-format=json --json=diagnostic
-rendered-ansi,artifacts,future-incompat --diagnostic-width=316 --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="calib3d"' --cfg 'feature="clang-runtime"' --cfg 'feature="dnn"' --cfg 'feature="features2d"' --cfg 'feature="flann"' --cfg 'feature="highgui"' --cfg 'feat
ure="imgcodecs"' --cfg 'feature="imgproc"' --cfg 'feature="rgb"' --cfg 'feature="tracking"' --cfg 'feature="video"' --cfg 'feature="videoio"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("alphamat", "aruco", "aruco_detector", "barcode", "bgsegm", "bioinspired", "calib", "calib3d", "ccalib", "clan
g-runtime", "cudaarithm", "cudabgsegm", "cudacodec", "cudafeatures2d", "cudafilters", "cudaimgproc", "cudalegacy", "cudaobjdetect", "cudaoptflow", "cudastereo", "cudawarping", "cvv", "default", "dnn", "dnn_superres", "dpm", "f16", "face", "features", "features2d", "flann", "freetype", "fuzzy", "gapi", "geometry", "
hdf", "hfs", "highgui", "img_hash", "imgcodecs", "imgproc", "intensity_transform", "line_descriptor", "mcc", "ml", "objdetect", "optflow", "ovis", "phase_unwrapping", "photo", "plot", "ptcloud", "quality", "rapid", "rgb", "rgbd", "saliency", "sfm", "shape", "signal", "stereo", "stitching", "structured_light", "supe
rres", "surface_matching", "text", "tracking", "video", "videoio", "videostab", "viz", "wechat_qrcode", "xfeatures2d", "ximgproc", "xobjdetect", "xphoto", "xstereo"))' -C metadata=71fa9657e43a1e36 -C extra-filename=-9a29d7ca9ae18cc2 --out-dir /home/username/rust_projects/project/target/release/deps -C strip=symbols -
L dependency=/home/username/rust_projects/project/target/release/deps --extern libc=/home/username/rust_projects/project/target/release/deps/liblibc-234c1e3d5f948d42.rmeta --extern num_traits=/home/username/rust_projects/project/target/release/deps/libnum_traits-b91d88d63166f7c1.rmeta --extern rgb=/home/username/rust_project
s/project/target/release/deps/librgb-18c1a2fa1bc32bd8.rmeta --cap-lints warn -L native=/home/username/rust_projects/project/target/release/build/opencv-5306aa0cc9669f95/out -L /usr/lib -L /opt/cuda/targets/x86_64-linux/lib -L /opt/cuda/targets/x86_64-linux/lib/stubs -L native=/usr/lib -l static=ocvrs -l stdc++ -l o
pencv_stitching -l opencv_alphamat -l opencv_bgsegm -l opencv_bioinspired -l opencv_ccalib -l opencv_cudabgsegm -l opencv_cudaobjdetect -l opencv_cudastereo -l opencv_cvv -l opencv_dnn_objdetect -l opencv_dnn_superres -l opencv_dpm -l opencv_face -l opencv_freetype -l opencv_fuzzy -l opencv_gapi -l opencv_hdf -l op
encv_hfs -l opencv_img_hash -l opencv_intensity_transform -l opencv_line_descriptor -l opencv_quality -l opencv_rapid -l opencv_reg -l opencv_rgbd -l opencv_saliency -l opencv_signal -l opencv_structured_light -l opencv_superres -l opencv_surface_matching -l opencv_videostab -l opencv_viz -l opencv_wechat_qrcode -l
 opencv_xfeatures2d -l opencv_xphoto -l opencv_xstereo -l cudart -l opencv_shape -l opencv_ptcloud -l opencv_phase_unwrapping -l opencv_cudacodec -l cuda -l dl -l static=rt -l opencv_cudaoptflow -l opencv_cudafeatures2d -l opencv_cudalegacy -l opencv_calib -l opencv_cudawarping -l opencv_optflow -l opencv_ximgproc 
-l opencv_xobjdetect -l opencv_objdetect -l opencv_photo -l opencv_cudaimgproc -l opencv_cudafilters -l opencv_cudaarithm -l opencv_stereo -l opencv_tracking -l opencv_highgui -l opencv_video -l opencv_videoio -l opencv_datasets -l opencv_imgcodecs -l opencv_plot -l opencv_text -l opencv_features -l opencv_dnn -l o
pencv_imgproc -l opencv_ml -l opencv_geometry -l opencv_flann -l opencv_core -l opencv_cudev --cfg ocvrs_opencv_branch_5 --cfg ocvrs_has_inherent_feature_cuda --cfg ocvrs_has_inherent_feature_opencl --cfg ocvrs_has_inherent_feature_hfloat --cfg ocvrs_has_inherent_feature_algorithm_hint --cfg ocvrs_has_module_calib3
d --cfg ocvrs_has_module_core --cfg ocvrs_has_module_dnn --cfg ocvrs_has_module_features2d --cfg ocvrs_has_module_flann --cfg ocvrs_has_module_highgui --cfg ocvrs_has_module_imgcodecs --cfg ocvrs_has_module_imgproc --cfg ocvrs_has_module_tracking --cfg ocvrs_has_module_video --cfg ocvrs_has_module_videoio --check-c
fg 'cfg(ocvrs_opencv_branch_34)' --check-cfg 'cfg(ocvrs_opencv_branch_4)' --check-cfg 'cfg(ocvrs_opencv_branch_5)' --check-cfg 'cfg(ocvrs_has_module_alphamat)' --check-cfg 'cfg(ocvrs_has_module_aruco)' --check-cfg 'cfg(ocvrs_has_module_aruco_detector)' --check-cfg 'cfg(ocvrs_has_module_barcode)' --check-cfg 'cfg(oc
vrs_has_module_bgsegm)' --check-cfg 'cfg(ocvrs_has_module_bioinspired)' --check-cfg 'cfg(ocvrs_has_module_ccalib)' --check-cfg 'cfg(ocvrs_has_module_calib)' --check-cfg 'cfg(ocvrs_has_module_calib3d)' --check-cfg 'cfg(ocvrs_has_module_core)' --check-cfg 'cfg(ocvrs_has_module_cudaarithm)' --check-cfg 'cfg(ocvrs_has_
module_cudabgsegm)' --check-cfg 'cfg(ocvrs_has_module_cudacodec)' --check-cfg 'cfg(ocvrs_has_module_cudafeatures2d)' --check-cfg 'cfg(ocvrs_has_module_cudafilters)' --check-cfg 'cfg(ocvrs_has_module_cudaimgproc)' --check-cfg 'cfg(ocvrs_has_module_cudalegacy)' --check-cfg 'cfg(ocvrs_has_module_cudaobjdetect)' --chec
k-cfg 'cfg(ocvrs_has_module_cudaoptflow)' --check-cfg 'cfg(ocvrs_has_module_cudastereo)' --check-cfg 'cfg(ocvrs_has_module_cudawarping)' --check-cfg 'cfg(ocvrs_has_module_cvv)' --check-cfg 'cfg(ocvrs_has_module_dnn)' --check-cfg 'cfg(ocvrs_has_module_dnn_superres)' --check-cfg 'cfg(ocvrs_has_module_dpm)' --check-cf
g 'cfg(ocvrs_has_module_face)' --check-cfg 'cfg(ocvrs_has_module_features)' --check-cfg 'cfg(ocvrs_has_module_features2d)' --check-cfg 'cfg(ocvrs_has_module_flann)' --check-cfg 'cfg(ocvrs_has_module_freetype)' --check-cfg 'cfg(ocvrs_has_module_fuzzy)' --check-cfg 'cfg(ocvrs_has_module_gapi)' --check-cfg 'cfg(ocvrs_
has_module_geometry)' --check-cfg 'cfg(ocvrs_has_module_hdf)' --check-cfg 'cfg(ocvrs_has_module_hfs)' --check-cfg 'cfg(ocvrs_has_module_highgui)' --check-cfg 'cfg(ocvrs_has_module_imgcodecs)' --check-cfg 'cfg(ocvrs_has_module_img_hash)' --check-cfg 'cfg(ocvrs_has_module_imgproc)' --check-cfg 'cfg(ocvrs_has_module_i
ntensity_transform)' --check-cfg 'cfg(ocvrs_has_module_line_descriptor)' --check-cfg 'cfg(ocvrs_has_module_mcc)' --check-cfg 'cfg(ocvrs_has_module_ml)' --check-cfg 'cfg(ocvrs_has_module_objdetect)' --check-cfg 'cfg(ocvrs_has_module_optflow)' --check-cfg 'cfg(ocvrs_has_module_ovis)' --check-cfg 'cfg(ocvrs_has_module
_phase_unwrapping)' --check-cfg 'cfg(ocvrs_has_module_photo)' --check-cfg 'cfg(ocvrs_has_module_plot)' --check-cfg 'cfg(ocvrs_has_module_ptcloud)' --check-cfg 'cfg(ocvrs_has_module_quality)' --check-cfg 'cfg(ocvrs_has_module_rapid)' --check-cfg 'cfg(ocvrs_has_module_rgbd)' --check-cfg 'cfg(ocvrs_has_module_saliency
)' --check-cfg 'cfg(ocvrs_has_module_sfm)' --check-cfg 'cfg(ocvrs_has_module_shape)' --check-cfg 'cfg(ocvrs_has_module_signal)' --check-cfg 'cfg(ocvrs_has_module_stereo)' --check-cfg 'cfg(ocvrs_has_module_stitching)' --check-cfg 'cfg(ocvrs_has_module_structured_light)' --check-cfg 'cfg(ocvrs_has_module_superres)' -
-check-cfg 'cfg(ocvrs_has_module_surface_matching)' --check-cfg 'cfg(ocvrs_has_module_text)' --check-cfg 'cfg(ocvrs_has_module_tracking)' --check-cfg 'cfg(ocvrs_has_module_video)' --check-cfg 'cfg(ocvrs_has_module_videoio)' --check-cfg 'cfg(ocvrs_has_module_videostab)' --check-cfg 'cfg(ocvrs_has_module_viz)' --chec
k-cfg 'cfg(ocvrs_has_module_wechat_qrcode)' --check-cfg 'cfg(ocvrs_has_module_xfeatures2d)' --check-cfg 'cfg(ocvrs_has_module_ximgproc)' --check-cfg 'cfg(ocvrs_has_module_xobjdetect)' --check-cfg 'cfg(ocvrs_has_module_xphoto)' --check-cfg 'cfg(ocvrs_has_module_xstereo)' --check-cfg 'cfg(ocvrs_has_inherent_feature_o
pencl)' --check-cfg 'cfg(ocvrs_has_inherent_feature_cuda)' --check-cfg 'cfg(ocvrs_has_inherent_feature_hfloat)' --check-cfg 'cfg(ocvrs_has_inherent_feature_algorithm_hint)'`


Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions