opencv-rust
opencv-rust copied to clipboard
Building project in compiling opencv-binding-generator fails-Can't get kind of parent for cpp namespace
So i run choco install llvm opencv
and then set OPENCV_LINK_LIBS
, OPENCV_LINK_PATHS
and OPENCV_INCLUDE_PATHS
. When i run cargo build
, the thread 'main' panicked at internal error, maybe I used the OpenCV API incorrectly, but my code is like this:
use opencv::prelude::*;
fn main() {}
When I use the example code, it also panicked at same error. I don't know what to do.
- Operating system: Windows 11
- The way you installed OpenCV: Installed via Chocolatey (choco install llvm opencv) with environment variables added manually.
- OpenCV version: 4.5.5
- rustc version: rustc 1.63.0
- Attach the full output of the following command from your project directory: error.txt
the same error
I was able to fix this by downgrading LLVM to version 14. I guess LLVM 15 is not supported right now.
I also downgraded to LLVM 14 from 15, but then I got some linker error. Was using vcpkg opencv before switching to chocolatey, but same linking error.
That's a great clue, I'll investigate, thank you!
I met the same problem. Then, I downgrade to llvm14, but get compile error:
fatal error: 'opencv2/videoio/registry.hpp' file not found
The error is casued by opencv-0.68.0/src_cpp/videoio.hpp
, which says:
#if !(CV_VERSION_MAJOR == 3 && CV_VERSION_MINOR == 2)
#include <opencv2/videoio/registry.hpp>
#endif
Then I checked the definition of CV_VERSION_MAJOR and CV_VERSION_MINOR, which is fixed set as:
pub const CV_VERSION: &str = "4.6.0";
pub const CV_VERSION_MAJOR: i32 = 4;
pub const CV_VERSION_MINOR: i32 = 6;
// Maybe somewhere else change the value, but I didn't realize.
Considering the problem may caused by version, I download the source code of opencv4.6 and compile it, then all things work.
Hope this info helps.
- Operating system: Liunx RHEL x86_64
- The way you installed OpenCV: Manually compile with cmake and export for pkgconfig.
- OpenCV version: 3.4.0
- Attach the full output of the following command from your project directory:
Thanks for all of the reports! This issue have been fixed in the latest release of the opencv-binding-generator
crate, just doing a cargo update
in the project directory should pull the fixed version (0.47.1).