Open demfabris opened 1 week ago
I also encountered this problem. Have you solved it? @demfabris
I'm also experiencing the same problem.
These method calls are all feature-gated, but the feature ocvrs_opencv_branch_32
feature does not exist.
e.g. in /opencv-0.93.1/src/manual/core/mat.rs:3
:
#[inline]
fn match_format<T: DataType>(mat_type: i32) -> Result<()> {
let out_type = T::opencv_type();
if mat_type == out_type {
Ok(())
} else {
#[cfg(not(ocvrs_opencv_branch_32))]
let mat_type = core::type_to_string(mat_type)?;
#[cfg(not(ocvrs_opencv_branch_32))]
let out_type = core::type_to_string(out_type)?;
Err(Error::new(
core::StsUnmatchedFormats,
format!("Mat type is: {mat_type}, but requested type is: {out_type}"),
))
}
}
Use DOCS_RS=1 cargo build
for now.
I'm pretty sure it has to do with the unconventional way the source code is compiled.
Module core is defined in /docs/core.rs
and the build step moves these files to OUT_DIR
for compilation.
I managed to successfully build with DOCS_RS=1 cargo build
. This indicates that the copying logic is not working properly here: build/docs.rs
I'm lacking too much context to attempt a fix here so I'll wait for owners input
From the looks of it seems like the binding to the core
OpenCV module are not being generated correctly. If possible, can anyone experiencing this error run a cargo build -vv
, note down the value of === Placing generated bindings into: <BINDING_DIR>
and then share the contents of the <BINDING_DIR>/core.rs
file?
Another potential culprit is the clang-19, I have only tested up to clang-18 so if possible can anyone can confirm that downgrading to clang-18 fixes the issue?
From the looks of it seems like the binding to the
core
OpenCV module are not being generated correctly. If possible, can anyone experiencing this error run acargo build -vv
, note down the value of=== Placing generated bindings into: <BINDING_DIR>
and then share the contents of the<BINDING_DIR>/core.rs
file?
From the stack trace file I attached:
<crateRoot>/target/debug/build/opencv-31aa7a5943655f3d/out/opencv
@demfabris Can you please attach that whole file so I can inspect it?
Another potential culprit is the clang-19, I have only tested up to clang-18 so if possible can anyone can confirm that downgrading to clang-18 fixes the issue?
clang-18 is ok
@YangKa Thanks for checking, I'll investigate
From the looks of it seems like the binding to the
core
OpenCV module are not being generated correctly. If possible, can anyone experiencing this error run acargo build -vv
, note down the value of=== Placing generated bindings into: <BINDING_DIR>
and then share the contents of the<BINDING_DIR>/core.rs
file?
Attached is an output of the target/debug/build/opencv-ecad4525e83befdf/out/opencv/core.rs
after running cargo build -vv on a clean build
core.rs.txt
clang --version
Homebrew clang version 19.1.1
Target: arm64-apple-darwin23.6.0
Thread model: posix
InstalledDir: /opt/homebrew/Cellar/llvm/19.1.1/bin
@demfabris @YangKa @peterjoel @chexov Can you please try the beta
branch to see if it fixes the issue you're encountering? I wasn't able to reproduce this exact issue on Linux, but I did encounter a similar issue with clang-19 that is now solved in v0.93.2 so I hope it will fix it for you too.
brew install opencv
$opencv_version: 4.10.0
rustc --version
): 1.81Clean library crate with a single import Using
opencv-rs 0.93
env variables set:
stacktrace.txt