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

Linking error on Windows 10 #360

Closed
usamazf opened this issue Aug 22, 2022 · 5 comments
Closed

Linking error on Windows 10 #360

usamazf opened this issue Aug 22, 2022 · 5 comments

Comments

@usamazf
Copy link

usamazf commented Aug 22, 2022

Hello, I am trying to use OpenCV compiled from source. I already have the OpenCV built manually working for me both in C++ and Python. But when using in rust I get linking errors. I have setup all required environment variables and have no idea why this issue is arising. Information needed for are as follows:

  1. Windows 10
  2. The way you installed OpenCV: Compiled latest version from source with contrib and GPU support
  3. OpenCV version = 4.6.0
  4. rustc version (rustc --version) = "rustc 1.63.0 (4b91a6ea7 2022-08-08)"
  5. Attach the full output of the following command from your project directory:
    linking_error.txt
@twistedfall
Copy link
Owner

Sounds like img_hash module is not built in the opencv_world460.dll, but is present in the headers in E:\Libraries\C++\opencv_gpu\opencv_build\install\include. Are the headers matching with the library being used? As a workaround you can try disable the img_hash feature if you're not using it so that this module is not build.

@yeokiwi
Copy link

yeokiwi commented Oct 1, 2022

I faced the same linking issue.
I compiled opencv with contrib with visual c++ 2022.
LLVM ver 14
opencv 4.6
i disabled img_hash feature but the linking still generated the same errors.
link_error.txt

@twistedfall
Copy link
Owner

Can you please post the full output of cargo build -vv after doing a cargo clean?

@yeokiwi
Copy link

yeokiwi commented Oct 1, 2022

Found the problem.
img_hash was not built into opencv_world460.lib. It was built separately as opencv_img_hash460.lib.
Therefore, to link properly, we had to add opencv_img_hash460.lib to OPENCV_LINK_LIBS.

OPENCV_LINK_LIBS = opencv_world460,opencv_img_hash460

the bindings worked fine after i included the img_hash lib.

@twistedfall
Copy link
Owner

Great find! I'll update the troubleshooting guide

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

3 participants