opencv-rust: Build opencv-rust fail in windows

Hi: I sure Vcpkg and opencv4 for Vcpkg has been installed. (I using vcpkg_cli test)

$ vcpkg_cli probe opencv4
Found library opencv4
Include paths:
  C:\SDKs\vcpkg\installed\x64-windows\include
Library paths:
  C:\SDKs\vcpkg\installed\x64-windows\lib
Runtime Library paths:
  C:\SDKs\vcpkg\installed\x64-windows\bin
Cargo metadata:
...
...
...

Source code and building refer to: Basic example file: window but still has error message, looks like I without installed Vcpkg-opencv.

   Compiling cpp v0.5.4
   Compiling opencv v0.29.3
error: failed to run custom build command for `opencv v0.29.3`

Caused by:
  process didn't exit successfully: `C:\Users\curlywei\Downloads\rust-test\opencvrs\target\debug\build\opencv-98c8a72dc5cf55ee\build-script-build` (exit code: 1)
--- stderr
=== Setting up OpenCV library from vcpkg
Error: "Package opencv4 is not found, caused by: Could not find library in Vcpkg tree opencv4"

warning: build failed, waiting for other jobs to finish...
error: build failed

How do I solve it

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

Well, the error is coming from the vcpkg crate so I’d first try setting up VCPKG_ROOT and possibly VCPKGRS_DYNAMIC environment variable (see https://docs.rs/vcpkg/0.2.8/vcpkg/). You might also want to take a look on CI files for some insight: https://github.com/twistedfall/opencv-rust/blob/master/ci/install-windows-vcpkg.sh#L1 and https://github.com/twistedfall/opencv-rust/blob/master/ci/script.sh#L13