Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot find function ... in module $crate::sys #479

Closed
yuyidegit opened this issue Aug 1, 2023 · 12 comments
Closed

cannot find function ... in module $crate::sys #479

yuyidegit opened this issue Aug 1, 2023 · 12 comments

Comments

@yuyidegit
Copy link

  1. Operating system:windows 11 23H2
  2. The way you installed OpenCV: vcpkg install llvm:x64-windows opencv4[contrib,nonfree]:x64-windows
  3. OpenCV version: 4.7.0
  4. rustc version:1.71.0
  5. Attach the full output of the following command from your project directory:
    RUST_BACKTRACE=full cargo build -vv 

build.log

@twistedfall
Copy link
Owner

Can you please try using version 0.83 of the crate to see if it fixes your build issue?

@yuyidegit
Copy link
Author

I have tried 0.83 and set VCPKGRS_DYNAMIC to "1",but get a lot of link error
build2.log

@leng-yue
Copy link

leng-yue commented Aug 7, 2023

Can you please try using version 0.83 of the crate to see if it fixes your build issue?

I met the same issue, and rolling back to 0.83 solved it.

@twistedfall
Copy link
Owner

@leng-yue @yuyidegit Did you by any chance try running cargo clean before building with 0.84 to see if it solves the issue?

@leng-yue
Copy link

leng-yue commented Aug 8, 2023

@twistedfall After cleaning, the 0.84.4 works now.
Update: this bug is not solved, and it seems the error only occurs in the release build.

@twistedfall
Copy link
Owner

Thanks for checking, I'm investigating!

@yuyidegit
Copy link
Author

After cleaning, use 0.84.4 and set VCPKGRS_DYNAMIC to "1",get a lot of link error just like use 0.83,but in wsl it works @twistedfall .

@foxzool
Copy link
Contributor

foxzool commented Aug 21, 2023

I have same error with windows 11, vcpkg opencv 4.8, VCPKGRS_DYNAMIC = 1
It's only work on 0.84.3
0.84.3-work.txt
0.84.5-master-not-work.txt
0.84.4-not-work.txt

@chriskyndrid
Copy link

+1, I run into this regularly on x64 Linux, specifically Fedora 37. I'm running the latest bindings:

694 |             unsafe { sys::std_vectorLintG_inputOutputArray(self.as_raw_mut_VectorOfi32(), ocvrs_return.as_mut_ptr()) };
     |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `std_vectorLfloatG_inputOutputArray`

Interestingly when I do cargo clean, 2-5 times, I'll eventually get a successful compilation. I don't really understand why a compilation will eventually work, subject to (n) number of cargo clean's and recompilation attempts.

I did not encounter this issue until I recently did a cargo update and ran into #480. Pinning to version:

[dependencies.opencv]
version = "0.84.5" #correct cc version --- see https://github.com/twistedfall/opencv-rust/issues/480 for upgrading
features = ["clang-runtime", "photo", "imgcodecs", "imgproc"]

Resolved the hang issue, but not this. I speculated perhaps the build process wasn't complete when the rust compiler proceeds resulting in those missing functions.

opencv version is 4.6(stock with Fedora 37)

@twistedfall
Copy link
Owner

@chriskyndrid I have tried reproducing this issue in a fresh Fedora 37 docker container. I installed git, clang, opencv and opencv-devel into it. And I installed rust using rustup. In a new cargo project with the following Cargo.toml:

[package]
name = "opencv-test"
version = "0.1.0"
edition = "2021"

[dependencies]
opencv = { version = "0.84.5", features = ["clang-runtime", "photo", "imgcodecs", "imgproc"]}

and main.rs:

use opencv::core;
use opencv::prelude::*;
use opencv::types::*;

fn main() {
    println!("Hello, world!");
    println!("{}", core::get_build_information().unwrap());
    let v = VectorOfi32::new();
    dbg!(v);
}

I have tried numerous (about 10) times to trigger this issue in both debug and release mode by running cargo clean; cargo run -vv and I haven't encountered an issue in any of the tries.

Will it possible for you to share the full build log cargo build -vv for both failed and successful build?

@chriskyndrid
Copy link

@twistedfall thanks for getting back to me and your work on this crate.

I will see what I can do. The project is quite large(it's a full fledged ERP system WIP with a lot of dependencies, ancillary functionality, etc). It's also made slightly more difficult as the problem is transient. As an example I just did a non -vv run build and was greeted with:


error[E0425]: cannot find function `std_vectorLintG_outputArray` in module `sys`
     |
3681 |             unsafe { sys::std_vectorLintG_outputArray(self.as_raw_mut_VectorOfi32(), ocvrs_return.as_mut_ptr()) };
     |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `std_vectorLfloatG_outputArray`
     |
     |
3505 |         pub fn std_vectorLfloatG_outputArray(instance: *mut c_void, ocvrs_return: *mut Result<*mut c_void>);
     |         ---------------------------------------------------------------------------------------------------- similarly named function `std_vectorLfloatG_outputArray` defined here

error[E0425]: cannot find function `std_vectorLintG_inputOutputArray` in module `sys`
     |
3694 |             unsafe { sys::std_vectorLintG_inputOutputArray(self.as_raw_mut_VectorOfi32(), ocvrs_return.as_mut_ptr()) };
     |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `std_vectorLfloatG_inputOutputArray`
     |3
     |
3506 |         pub fn std_vectorLfloatG_inputOutputArray(instance: *mut c_void, ocvrs_return: *mut Result<*mut c_void>);
     |         --------------------------------------------------------------------------------------------------------- similarly named function `std_vectorLfloatG_inputOutputArray` defined here


etc....

Of course adjusting my run script to include -vv, and built fine. I'll keep running cargo clean && cargo run -vv and see if I can get a good capture.

@twistedfall
Copy link
Owner

This issue should now be fixed in 0.85.3

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

No branches or pull requests

5 participants