Skip to content

Is vcpkg required if I installed from Chocolaty #118

@hyousefGopher

Description

@hyousefGopher

At Window10, I installed opencv and llvm using chocolaty, trying to run simple example:

use opencv::{
    core,
    highgui,
    prelude::*,
    videoio,
};

fn run() -> opencv::Result<()> {
    let window = "video capture";
    highgui::named_window(window, 1)?;
    #[cfg(feature = "opencv-32")]
    let mut cam = videoio::VideoCapture::new_default(0)?;  // 0 is the default camera
    #[cfg(not(feature = "opencv-32"))]
    let mut cam = videoio::VideoCapture::new(0, videoio::CAP_ANY)?;  // 0 is the default camera
    let opened = videoio::VideoCapture::is_opened(&cam)?;
    if !opened {
        panic!("Unable to open default camera!");
    }
    loop {
        let mut frame = core::Mat::default()?;
        cam.read(&mut frame)?;
        if frame.size()?.width > 0 {
            highgui::imshow(window, &mut frame)?;
        }
        let key = highgui::wait_key(10)?;
        if key > 0 && key != 255 {
            break;
        }
    }
    Ok(())
}

fn main() {
    run().unwrap()
}

With Toml as:

opencv = "0.34"

But I got the below error:

D:\rust_webview>cargo run
Compiling webview-sys v0.5.0
Compiling tinyfiledialogs v3.3.9
Compiling opencv v0.34.0
error: failed to run custom build command for opencv v0.34.0

Caused by:
process didn't exit successfully: D:\rust_webview\target\debug\build\opencv-0980f6e1ac4b8856\build-script-build (exit code: 1)
--- stderr
=== Environment configuration:
=== OPENCV_HEADER_DIR = None
=== OPENCV_PACKAGE_NAME = None
=== OPENCV_PKGCONFIG_NAME = None
=== OPENCV_LINK_LIBS = None
=== OPENCV_LINK_PATHS = Some("C:\tools\opencv\build\x64\vc14\lib")
=== OPENCV_INCLUDE_PATHS = Some("C:\tools\opencv\build\include")
=== PKG_CONFIG_PATH = None
=== VCPKG_ROOT = None
=== Setting up OpenCV library from vcpkg
Error: "Package opencv4 is not found, caused by: Could not find Vcpkg tree: No vcpkg.user.targets found. Set the VCPKG_ROOT environment variable or run 'vcpkg integrate install'"

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions